最新公告
  • 欢迎您光临站盟网(原知事网),一个优质的网站源码基地、精品网站模板和插件。欢迎加入永久SVIP
  • 解决win主机wordpress伪静态后根目录下其他文件访问404错误

    正文概述 知事网   2014-06-24 11:06   538

    最近把博客搬家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错误。


    站盟网 » 解决win主机wordpress伪静态后根目录下其他文件访问404错误

    发表评论

    还没有评论,快来抢沙发吧!

    如需帝国cms功能定制以及二次开发请联系我们

    联系作者
    请选择支付方式
    ×
    支付宝支付
    微信支付
    余额支付
    ×
    微信扫码支付 0 元