How to redirect all pages of old domain to new urls?

Joined
Feb 16, 2015
Messages
304
Reaction score
36
I have a few thousand pinterest pins which all point to different pages on one of my websites.

I want them redirected to a php script which will then redirect to random affiliate links. I know how to redirect just the domain in the hosting but not how to do all urls.

How to do it?
 
You can use .htacess rule to redirtect all pages:
RewriteEngine on
RewriteCond %{http_host} ^www DOT old DOTcom [NC,OR]
RewriteCond %{http_host} ^old DOT com [NC]
RewriteRule ^(.*)$ thenewdomain DOT org/ [R=301,NC,L]
 
Last edited:
You can use .htacess rule to redirtect all pages:

RewriteEngine on
RewriteRule ^(.*)$ thenewdomain DOT com/$1 [R=permanent,L]

Why $1 ?? I also want to use this but it popups me an error
 
Can i send them to a php script on the same domain or will that screw it up?

I want to send all urls to x.php. I would prefer have it on the same domain but would find another one if it would be tricky.
 
Back
Top