我的网站上有标准的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>该站点曾经位于子目录(mysite.com/1/)中,现在是root用户,我想确保对子目录的任何请求都重定向到root。 上面的规则对于包含永久链接的页面(我假设因为RewriteBase)这样做,例如mysite.com/1/contact被重定向到mysite.com/contact,但不是主页,所以mysite.com/1/不是重定向到mysite.com。
任何人都可以提供解决方案将子目录中的主页请求重定向到root吗?
I have the standard wordpress rewrite rules on my site:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>The site used to be in a subdirectory (mysite.com/1/), and is now in root, and I want to make sure that any requests for the subdirectory are redirected to root. The rules above do this for pages with permalinks (I assume because of the RewriteBase), e.g. mysite.com/1/contact is redirected to mysite.com/contact, but not for the homepage, so mysite.com/1/ is NOT redirected to mysite.com.
Can anyone provide a solution to redirect requests for the homepage in the subdirectory to root?
最满意答案
我找到了解决方案。 我在原规则下添加了这条规则:
Redirect /1 http://mysite.comI found a solution. I added this rule under the original rules:
Redirect /1 http://mysite.com更多推荐
发布评论