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
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With