2016-04-22 65 views
1

我已经主持网站的根文件夹和根文件夹指向http://www.example.com和我有根/子文件夹上传其指向www.upload.com如何停止的子文件夹重定向到根

现在,当我使用

RewriteBase/

Redirect 302 /index.html http://www.example.com/index.php 

现在无论example.com/index.html被重定向到example.com/index.php

upload.com/index.html被重定向example.com/index.php

如何避免upload.com/index.html重定向到example.com/index.php

回答

0

使用重定向指令不能避免这种重定向,您需要使用国防部重写的条件,

试试下面的代码htaccess的:

RewriteEngine on 
#IF http_host=="www.example.com"# 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ 
#redirect "/index.html" to "/index.php"# 
RewriteRule ^index\.html$ /index.php [NC,L,R,NE] 
+1

感谢starkeen,此解决方案解决了我的问题。 – Shankar

相关问题