URL Aliasing using .htaccess

天大地大妈咪最大 提交于 2019-12-12 01:35:08

问题


I have a directory 'Domainname1/folder/'. In Domainname1, I have a sub-directory which is a sub-domain (abc.mydomain.com) of another domain. This is a reference to 'domainname1/folder/'. The thing is I want the URL links accessing 'domainname1/folder/' to display the sub-domain definition. So instead of seeing:

'domainname1/folder/'

They see:

'abc.mydomain.com/path'

How can I do this?


回答1:


you should use a reverse proxy to do such setup, here a basic howto.

Hope this would help you




回答2:


You can use the proxying abilities of mod_rewrite to achieve this. In the VirtualHost section for abc.mydomain, you can add:

RewriteRule (.*) http://mydomain/folder/$1 [P]
ProxyPassReverse / http://mydomain/folder


来源:https://stackoverflow.com/questions/1685763/url-aliasing-using-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!