0
我正在尋找將「存檔」的子域添加到單擊的URL以允許它們轉到新存檔站點而不是常規站點。您可以訪問該網站http://archives.thegatepost.com,並瞭解我想要做什麼。mod_rewrite將子域添加到URL
- 用戶訪問網站:#http://archives.thegatepost.com/archived06.html
- 用戶點擊鏈接查看:#http://www.thegatepost.com/news/GP_pgs1-4.pdf
重新寫入:#http://archives.thegatepost.com/news/GP_pgs1-4.pdf
這需要能夠實現在.htaccess文件中
不擔心301或類似的東西。如果它可以做SEO友好,所有更好,如果不是沒有損失。
我已經試過Apache mod_rewrite domain to subdomain?,並且它不工作:
RewriteEngine On
RewriteCond %{http_host} ^thegatepost.com/archives [nc]
RewriteRule ^(.*)$ http://www.thegatepost.com/archives/$1 [R=301,NC]
RewriteCond %{HTTP_HOST} ^www\.thegatepost\archives\.com$ [NC]
RewriteRule ^archives/([a-z0-9\-_\.]+)/?(.*)$ http://$1.thegatepost.com/archives/$2 [QSA,NC,R,L]