【问题标题】:Rewrite rule for website in Sub-Directory子目录中网站的重写规则
【发布时间】:2013-01-17 03:17:02
【问题描述】:

我有 WordPress 网站,并在其中安装了另一个网站的子目录。子网站的所有子页面都有 URL 404 问题(安装在子目录中)

它正在加载子网站的登录页面,但一旦尝试访问任何页面或发布它就会给出 404 错误。这个 CMS 有自己的 .htaccess。

Path:
Wordpress: wp/.htaccess
QA:        wp/qa/.htaccess

Wordpress .ht 访问代码

# 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

QA .htaccess 代码

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

我对重写规则了解不多,所以请帮我解决这个问题。万分感谢

【问题讨论】:

    标签: .htaccess mod-rewrite


    【解决方案1】:

    尝试将 QA .htaccess 更改为此:

    DirectoryIndex index.php
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /qa/
    RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
    RewriteRule . %1/%2 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ /qa/index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
    </IfModule>
    

    【讨论】:

    • 我无话可说,感谢您的快速帮助。它工作得很好,解决了我的问题,即使我的主机提供商的技术支持从 1 小时开始就试图解决这个问题。百万感谢
    猜你喜欢
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    • 1970-01-01
    • 2012-02-11
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    • 1970-01-01
    相关资源
    最近更新 更多