Forum Moderators: coopster & phranque

Message Too Old, No Replies

Redirect script help

I believe it can be done

         

dublinmike

6:54 pm on Jun 26, 2002 (gmt 0)

10+ Year Member



Hi folks,

I understand I can use a script to redirect domain requests to a certain folder on my server.

eg
Master domain www.mydomain.com
secondary domain www.mydomain2.com also points to www.mydomain.com but gets redirected to say www.mydomain.com/anotheruser/

(a)What script do I need to do this and
(b)what url does the user see in the browser? Does the user see www.mydomain.com/anotheruser/index.html or www.mydomain2.com/index.html

All advice gets free pints next time you're in Ireland.

cheers

Mike

ergophobe

7:32 pm on Jun 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can take a few approaches, but I think the best for your situation is not to use a script, but simply URL rewriting which "translates" the URL to something else.

The user sees the URL from the oringal link, but is redirected to another page.

You can also use PHP to send new header info an redirect, but this would be a lot less efficient.

You can get a primer on how to do this at

[httpd.apache.org...]

I'm not sure I have all the slashes right - hoepfully someone better at mod_rewrite will chime in and correct my gross errors! Anyway, in your .htaccess in the highest level directory

RewriteEngine on
RewriteRule ^www.mydomain2.com/(.*) [mydomain.com...]

Tom