2016-07-08 21 views
-2

我有一個域名爲foo.techapache重寫規則無故添加/ html目錄

我想用一個新的域名footech.io來代替。

重定向也必須確保所有的URL工作。

E.g foo.tech/barfootech.io/bar

這裏是我的.htaccess文件:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^foo.tech [NC] 
RewriteRule ^(.*) http://footech.io/$1 [R=301,L] 

出於某種原因,它決定在我的網域的末尾添加/html

所以,現在如果我訪問foo.tech會重定向到footech.io/html

如果我訪問foo.tech/bar會重定向到footech.io/html/bar

請幫助。

更新:

我覺得/html來自$1

我試圖使重寫規則如下:

RewriteRule ^(.*) http://footech.io/$1/$1 [R=301,L] 

foo.tech導致footech.io/html//html/

前往foo.tech/bar導致footech.io/html/bar/html/bar

最後更新: 我做到了,現在工作中使用此:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^foo.tech [NC] 
RewriteRule ^html/(.*) http://footech.io/$1 [R=301,L] 
+0

我做了明確的瀏覽器緩存,不知道哪條規則,你是在談論 – user1181031

回答

0

這似乎解決它

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^foo.tech [NC] 
RewriteRule ^html/(.*) http://footech.io/$1 [R=301,L]