2016-04-22 63 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

相關問題