我有兩個域指向同一臺服務器。
域A是我的歷史域。
域 B 是一個新域,是域 A 的別名。我不知道該域的 DNS 配置。
我希望域 B 使用 .htaccess 指向我的服務器的檔案夾(或域 A 的子域)
謝謝
uj5u.com熱心網友回復:
這可能就是你要找的:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domainB\.com$
RewriteCond %{REQUEST_URI} !^/folder/domainB/
RewriteRule ^ /folder/domainB%{REQUEST_URI} [L]
另一種選擇是:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domainB\.com$
RewriteRule ^/?folder/domainB(/.*)$ https://%{HTTP_HOST}$1 [R=301,END]
RewriteCond %{HTTP_HOST} ^(www\.)?domainB\.com$
RewriteRule ^ /folder/domainB%{REQUEST_URI} [END]
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/332878.html
標籤:.htaccess
