Redirect a domain to a single page on another server

New to mod_rewrite? This is a good place to start.

Redirect a domain to a single page on another server

Postby George » Thu Mar 04, 2004 5:13 am

Hi, I am new to mod_rewrite and trying to move my files to another domain and will be changing much of the structure but don't want to leave visitors to the old domain hanging. I would like to redirect all traffic to a single page on the new server and have tried:

RewriteEngine On

RewriteRule ^(.+)$ http://www.domain.com/$1 [R,L]

but this looks for the requested page on the new server and adding the desired page after domain.com gets an internal error.

Any help would be appreciated.

Thanks,
George
George
 

Postby Guest » Thu Mar 04, 2004 11:36 pm

OK I am now using this code:

RewriteEngine on
RewriteRule ^([a-z]*)/?$ http://mydomain.com/mypage.htm?category=$1

this is working for directory requests with no filename for example http://mydomain.com/ or http://mydomain.com/subdirectory but if adding a filename for example http://mydomain.com/file.htm it looks for this file in the new domain. Should I add an additional rule to cover this or can this code be modified for the desired results? Thanks for any help...

George
Guest
 


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 19 guests

cron