我有一个托管平台http://example.com的托管域http://example2.com。.htaccess主域到子文件夹,但/子文件夹仍然可到达
问题是,如果我去http://example2.com/example2/fr,我没有被重定向到http://example2.com/fr,我尝试了解决方案,但仍然保持重定向循环。
在的public_html文件夹中,有一个子文件夹/例题与文件http://example2.com
> public_html
- .htaccess
- index.php
> assets
> css
> js
> example2
- .htaccess
- index.html
> fr
- index.html
> en
- index.html
现在,在文件夹中的public_html,在我的.htaccess文件我的重定向规则是:
<IfModule mod_rewrite.c>
RewriteEngine on
# Redirect the example2 to the subfolder /example2
RewriteCond %{HTTP_HOST} ^(www\.)?example2\.com$ [NC]
RewriteRule !^example2/ /example2%{REQUEST_URI} [L,NC]
</IfModule>
在/ example2文件夹中,我的htaccess文件如下重定向:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^index\.html$/[R=301,L]
RewriteRule ^(.*)/index\.html$ /$1 [R=301,L]
#RewriteRule ^(.*)$ /$1 [R=301,L]
</IfModule>
如果删除/subfolder/.htaccess,会发生什么情况? – starkeen