Forum Moderators: phranque

Message Too Old, No Replies

Domain redirection problem with mod rewrite

         

zondi

9:08 am on Sep 16, 2010 (gmt 0)

10+ Year Member



Hi all you good people.
I'm a bit clueless with mod_rewrite and I'm stuck with a domain redirection problem with mod_rewrite.

Here's the situation:

I have a domain name www.mydomain.com which is redirected to www.myotherdomain.com/somefolder.
www.myotherdomain.com/somefolder is then displayed on the browser's address bar.
I would like the users to see www.mydomain.com instead.

My ISP told me to try this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^/* [myotherdomain.com...] [L,R]

No success.

I didn't find this kind of a redirection case in the Apache URL Rewriting Guide or elsewhere on the web.
Is the mod_rewrite the right tool for this at all?

I'll be thankfull for any hints that will point me in the right direction.
Thanks!

jdMorgan

3:28 pm on Sep 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are these hostnames ("domains") hosted under the same filespace root on the same physical server?

If so, then you need an internal rewrite, not a redirect.

If not, then you will need to set up a reverse proxy, not a redirect. This may not be allowed by your host, as many hosts do not support the Apache proxy functions.

Jim