Reputation: 329
I'm trying to redirect only the root domain (and not its subfolders) to another URL, without changing the address. I'm using .htaccess and redirecting with [P] flag, which works fine for subdirectories but not for the root.
When writing the following .htaccess everything works fine, but in 'regular' redirect and not proxy:
RewriteEngine on
Rewriterule ^$ http://mysubdomain.mydomain.com/ [R,L]
When changing to mod_proxy, it doesn't work (does not redirect without an error):
RewriteEngine on
Rewriterule ^$ http://mysubdomain.mydomain.com/ [P]
It is important to me to keep the original address in the browser address bar. any idea?
Thanks
Upvotes: 3
Views: 305
Reputation: 96
It's probably doesn't work because the rule doesn;t apply. In most cases the root is not empty, but contains a request to index.html or default.html . Give this snippet a try:
RewriteEngine on
RewriteRule "default.html" "http://mysubdomain.mydomain.com/" [P]
Upvotes: 5