最近把博客搬家windows 2003 +IIS6.0的服务器上面,结果发现目录下面的一些html文件访问出现了404,网站当然是启用了伪静态的,所以就想是不是伪静态组件或者是规则出问题。可以检测到伪静态是设置成功的,但是在根目录放一个html文件却打不开。问题原来是出在伪静态规则这里:
解决方法:
把最后两行:
RewriteRule ^/$ /index.php [L] RewriteRule /(.*) /index.php/$1 [L]
替换成:
RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
最终正确代码:
RewriteEngine On RewriteCompatibility2 On RepeatLimit 200 RewriteBase RewriteRule /tag/(.*)/$ /index.php?tag=$1 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # Rules to ensure that normal content gets through RewriteRule /robots.txt /robots.txt [L] RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /favicon.ico /favicon.ico [L] # For file-based wordpress content (i.e. theme), admin, etc. RewriteRule /wp-(.*) /wp-$1 [L] # For normal wordpress content, via index.php RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
然后回头看看网站是不是问题就解决了呢?如果光换了httpd.ini还不行的话,就把根目录下面的.htaccess文件里面的代码也替换成这段代码。
*已修正中文Tag标签出现404错误。
发表评论
还没有评论,快来抢沙发吧!