[英].htaccess 301 redirect one subdomain to another, for multiple TLDs
[英]How can I redirect from one subdomain to another in .htaccess?
最近,我們更改了子域的名稱,現在我們需要將所有舊頁面重定向到新的子域頁面。
頁面鏈接示例:
舊網址: http : //jquery.webcodehelpers.com/2013/08/what-does-dollar-sign-means-in-jquery.html
新網址: http : //uieiq.webcodehelpers.com/2013/08/what-does-dollar-sign-means-in-jquery.html
我的發現:當我嘗試訪問頂級子域時,它運行良好。
如何將舊子域上的所有URL重定向到新子域?
目前我在.htaccess文件中有以下代碼,請指導解決問題
RewriteEngine on
RewriteCond %{HTTP_HOST} ^jquery\.webcodehelpers\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.jquery\.webcodehelpers\.com$
RewriteRule ^/?$ "http\:\/\/uieiq\.webcodehelpers\.com\/search\/label\/jquery\ interview\ questions" [R=301,L]
通過httpd.conf
啟用mod_rewrite
和.htaccess
,然后將此代碼放入DOCUMENT_ROOT/.htaccess
文件中:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^jquery\.webcodehelpers\.com$ [NC]
RewriteRule ^ http://uieiq.webcodehelpers.com%{REQUEST_URI} [L,R=301,NE]
這為我工作,並維護URI:
RewriteCond %{HTTP_HOST} ^jquery\.webcodehelpers\.com
RewriteRule (.*)$ http://uieiq.webcodehelpers.com/$1 [R=301,L]
我用它來將一個子域重定向到另一個子域。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.