its_ns_04
asked on
http redirection
Hi ,
I am planning to phase out my previous url www.mydomain.com/mypage and replace it by myplace.com
I have a rewrite rule in the virtual host configuration file of myplace as below:
RewriteEngine On
RewriteRule ^/(.*) http://www.mydomain.com/mypage [R]
Now, whenever I type myplace.com in the browser, it fetches the web pages from www.mydomain.com/mypage properly. It does its job...
but the problem over here is, it also at the same time changes URL in the address bar of the browser to www.mydomain.com/mypage.
I simply want pages to be fetched from www.mydomain.com/mypage whenever I type mypage.com. I don't want any changes in URL of the browser. How do I avoid it ??
I am planning to phase out my previous url www.mydomain.com/mypage and replace it by myplace.com
I have a rewrite rule in the virtual host configuration file of myplace as below:
RewriteEngine On
RewriteRule ^/(.*) http://www.mydomain.com/mypage [R]
Now, whenever I type myplace.com in the browser, it fetches the web pages from www.mydomain.com/mypage properly. It does its job...
but the problem over here is, it also at the same time changes URL in the address bar of the browser to www.mydomain.com/mypage.
I simply want pages to be fetched from www.mydomain.com/mypage whenever I type mypage.com. I don't want any changes in URL of the browser. How do I avoid it ??
ASKER
hmm.. I tried without [R] too...but it is not helping me...
do u have any clues on how to fix it ?
do u have any clues on how to fix it ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I believe you can do what you want by using the proxy functionality of mod_rewrite. Try changing the [R] for redirect to a [P] for proxy and see what happens. I'm not sure if you need to add a few more tweaks or not.
take a look at this link for a bit more info:
http://httpd.apache.org/docs/1.3/misc/rewriteguide.htmlhttp://httpd.apache.org/docs/1.3/misc/rewriteguide.html
take a look at this link for a bit more info:
http://httpd.apache.org/docs/1.3/misc/rewriteguide.htmlhttp://httpd.apache.org/docs/1.3/misc/rewriteguide.html
ASKER
solution not totally clear
Since your virtual host probably needs mydomain.com in the request headers, a redirect is probably required, and there is no easy fix. However, if both domains are on the same virtual host, you may be able to do rewrite rules that just direct it to the new content (with out the [R], but also more importantly with out the domain name) that might reside in a different directory.