-2
我有一個域名爲foo.tech
。apache重寫規則無故添加/ html目錄
我想用一個新的域名footech.io
來代替。
重定向也必須確保所有的URL工作。
E.g foo.tech/bar
去footech.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]
我做了明確的瀏覽器緩存,不知道哪條規則,你是在談論 – user1181031