规则如下:
代码: 全选
RewriteRule ^/admin(.*) /admin/$1 [L]
RewriteRule ^(.*)(html|htm)$ /index\.php/$1$2 [L]
RewriteRule ^([^.]+)$ /index\.php/$1 [L]
后台必须要加Index.php才能进去,不加index.php就是404
代码: 全选
RewriteRule ^/admin(.*) /admin/$1 [L]
RewriteRule ^(.*)(html|htm)$ /index\.php/$1$2 [L]
RewriteRule ^([^.]+)$ /index\.php/$1 [L]
代码: 全选
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
用了这个规则直接网页乱码了............,后台也跳转到前台aneasystone 写了:你可以试试下面的规则:代码: 全选
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L]
乱码是能出来文字,但是无规则排列,开始设置的删除了再添加的规则,就出现首页无规则排列,然后后台还是404,加上index.php又返回主页了,其他配置倒是没有什么,规则也是按照你发的填上去然后重启IISaneasystone 写了:这个只是Web服务器的重写规则,应该和乱码没关系的。
另外,除了这个重写规则,你的IIS还有没有做过其他的配置或者其他的重写规则呢?
已经解决,换了规则,全部已无问题,后台什么的都没问题了,aneasystone 写了:额,试下WAMP环境吧,看下WAMP环境下可正常?
代码: 全选
RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 32
RewriteBase
# unsupported directive: [ISAPI_Rewrite]
# 3600 = 1 hour
# unsupported directive: CacheClockRate 3600
RewriteRule ^/tag/(.*)$ /index\.php\?tag=$1
RewriteRule ^/sitemap.xml$ /sitemap.xml [L]
RewriteRule ^/favicon.ico$ /favicon.ico [L]
RewriteRule ^/(.*).html$ /index.php/$1.html [L]
RewriteRule ^/(.*)/comment$ /index.php/$1/comment [L]
RewriteRule ^/category/(.*)$ /index.php/category/$1 [L]
RewriteRule ^/page/(.*)$ /index.php/page/$1 [L]
RewriteRule ^/search/(.*)$ /index.php/search/$1 [L]
RewriteRule ^/feed/(.*)$ /index.php/feed/$1 [L]
RewriteRule ^/2(.*)$ /index.php/2$1 [L]
RewriteRule ^/action(.*)$ /index.php/action$1 [L]