How To Redirect One Page Of A Website To A New Domain

I recently came across an issue where one of our clients wanted to redirect only one page of their website to a different domain. This type of redirect did seem to be under-documented on the internet because as hard as I looked (about 2 minutes), I couldn’t find a semi-recent blog post for this specific issue.

So I thought that when I find out what the solution is, I’m going to write it myself, so here it is.

This one should be done in the .htaccess file of a website. For non-technical people, I highly recommend copying what’s already in the file to a notepad++ document, as a mistake could lead to the website going blank, which is obviously quite serious. If you do happen to make a mistake you can paste the original back in. If for some reason that doesn’t work or you are afraid that it won’t work, then you may want to invest in a daily backup of your website.

The example below would be used for the imaginary pages:

http://www.current-website.co.uk/redirecting-page/

which will redirect to

http://www.new-website.com/target-page/

 

Process

 

Go into .htaccess file of the current website, and add this underneath “RewriteEngine On” so it contains something like this (obviously change this to what you need):

RewriteRule ^redirecting-page/$ http://www.new-website.com/target-page/ [R=301]

Notice how current-website.co.uk isn’t included, as you only need the path of the page, nothing else.

 

Also remember to include the whole URL for the target website including http:// and trailing slashes.

Another thing to remember is that if the redirecting page ends in .html you will need to replace the . with a backslash.

 

So if the page was http://www.current-website.co.uk/redirecting-page.html,

in the Rewrite Rule it will look like ^redirectingpage\.html$

 

I hope you are now able to redirect one page of your website to a new domain.

If you need help improving your website performance, feel free to get in touch.

 

Andrew Hall
andrew@bowlerhat.co.uk

Andrew is our Web Developer. He has more web skills than Spiderman (really) and optimises websites to be speedy and search-engine friendly. He even dabbles in SEO when he’s feeling funky.

No Comments

Post A Comment