【问题标题】:Wordpress Htaccess - stop subdirectory auto redirecting to root indexWordpress Htaccess - 停止子目录自动重定向到根索引
【发布时间】:2014-09-13 11:55:54
【问题描述】:

我正在尝试在 wordpress 上创建一个子目录

http://wpsite.com/codeigniter, http://wpsite.com/someothersubdir

但是当我转到那个 url 时,它总是会重定向回 wordpress 网站并显示“找不到页面”

这里是 wordpress 根 htaccess 文件

# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

如何使子目录与 wordpress 分开?谢谢

【问题讨论】:

    标签: php wordpress apache .htaccess


    【解决方案1】:
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/codeigniter/
    RewriteCond %{REQUEST_URI} !^/someothersubdir/
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    

    【讨论】:

      【解决方案2】:

      在我的情况下,问题出在子文件夹的 htaccess 中(为了测试目的,我运行了另一个 wordpress)。所以我不得不把子文件夹的.htaccess改成这样:

      # BEGIN WordPress
      
      <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /someothersubdir
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>
      
      # END WordPress
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-08
        • 1970-01-01
        • 2014-06-21
        • 2021-04-04
        • 2017-06-26
        • 1970-01-01
        相关资源
        最近更新 更多