HTACCESS redirect each page to new URL of same page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

HTACCESS redirect each page to new URL of same page

Post by simonmlewis »

Hi

I need to do a 301 from each URL on our site, to a new site, that has the same structure and DB. So ALL URLS will be the same, except the domain name.

How do I do that in htaccess?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: HTACCESS redirect each page to new URL of same page

Post by Celauran »

[text]RewriteEngine On
RewriteRule ^(.*)$ http://new.domain.com/$1 [R=301,L][/text]
Post Reply