0
我在我的網站mobil.test.nu上有重定向規則。完成DNS更改後,舊重定向會發生什麼
# For mobile devices:
RewriteCond %{HTTP_USER_AGENT} (android|blackberry|iphone|ipod|windows\ phone) [NC]
RewriteRule^http://test.nu/ [L,R=301]
# For non-mobile devices:
RewriteRule ^/?$ http://test.nu/mobil/index.htm [L,R=301]
RewriteRule ^(.*)$ http://test.nu/mobil$1 [L,R=301]
一些請求重定向到test.nu.
我正在做的測試.nu的mobil.test.nu的DNS更改。
我認爲我不得不重寫所有的請求,這些請求是來自mobil.test.nu,再次在test.nu中。
有人能告訴我如何在dns更改後識別來自mobil.test.nu的請求。
編輯 識別主機名和修改。
# For mobile devices:
RewriteCond %{HTTP_HOST} ^mobile\.test\.nu$ [NC]
RewriteCond %{HTTP_USER_AGENT} (android|blackberry|iphone|ipod|windows\ phone) [NC]
RewriteRule^http://test.nu/ [L,R=301]
# For non-mobile devices:
RewriteCond %{HTTP_HOST} ^mobile\.test\.nu$ [NC]
RewriteRule ^/?$ http://test.nu/mobil/index.htm [L,R=301]
RewriteRule ^(.*)$ http://test.nu/mobil$1 [L,R=301]
謝謝你的回答。我想,我可以確定主機並按照您的建議書寫規則。 – Patan
請幫我檢查他們是否正確的規則不是。我編輯了我的問題。 – Patan
即使在DNS更改之後,我是否能夠使用RewriteCond%{HTTP_HOST}^mobile \ .test \ .nu $捕獲原始主機[NC] – Patan