开发者

htaccess rewrite rule to subdirectory and then hide the url?

开发者 https://www.devze.com 2023-03-12 13:32 出处:网络
I have a subdomain called sub.domain2.com which I want to point to domain1.com/folder/ I have set up an A record to point sub.domain2.com to domain1.com and a rewrite rule to the point the开发者_如何

I have a subdomain called sub.domain2.com which I want to point to domain1.com/folder/

I have set up an A record to point sub.domain2.com to domain1.com and a rewrite rule to the point the开发者_如何学C subdomain to the subdirectory:

RewriteCond %{HTTP_HOST} sub\.domain2\.com$
RewriteRule (.*) http://sub.domain2.com/folder/$1 [L]

However I don't want the subdirectory /folder/ showing in the URL which it currently is?

Thanks Alex


remove http://.../ because it will force external redirect.

RewriteCond %{HTTP_HOST} sub\.domain2\.com$
RewriteRule (.*) /folder/$1 [L]


Why don't you set DOCUMENT_ROOT of sub.domain2.com to domain1.com/folder in your apache config.

0

精彩评论

暂无评论...
验证码 换一张
取 消