Forum Moderators: phranque

Message Too Old, No Replies

301 .htaccess Redirect Rewrite Question

Make it show what you want?

         

jbgilbert

7:29 pm on Mar 19, 2004 (gmt 0)

10+ Year Member



The following .htaccess entry is working fine. It redirects a visitor from domain.com/realfile.shtml
to
newdomain.com

RewriteEngine on
rewriterule ^realfile\.shtml$ [newdomain.com...] [R=301,L]

BUT

I need to change it so that after the redirect the "ORIGINAL" domain (URL) still shows in the browser address line, rather than showing the URL of the new domain the user is directed to?

Can somebody help?

bhartzer

7:58 pm on Mar 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could this type of redirect be done in the DNS or would it have to be in the .htaccess file?

jbgilbert

8:05 pm on Mar 19, 2004 (gmt 0)

10+ Year Member



I need to use the .htaccess file. Can somebody please help me with this?

jdMorgan

10:02 pm on Mar 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jgilbert,

You're probably going to have to provide more info to get a good answer.

I can tell you that if the newdomain is hosted on a separate server (virtual or otherwise) then no, you can't "change domains" without the involvement of the client browser, and therefore, the address bar will be updated.

If you need to show content from one domain under another domain, two methods that will work are using iframes or setting up the old domain as a proxy server for the new domain. There are other scripted solutions as well. But it would be of help if you would say what you are trying to accomplish in the end, otherwise, we don't even know what forum might be most helpful to you.

Jim