Website designs and more
Services
About
Portfolio
Contact

How to redirect all pages on a website

Jul 1, 2011 | Web Developer Tips | 0 comments

It’s very easy to redirect all your old web pages to a new domain or URL using a .htaccess file. This can only be done on an Apache server which most of you should have your site hosted on anyway. Here is what you do.

Download the .htaccess file in the root of your web server and paste the line below into it. If you don’t see one, (make sure these files are not hidden), create a new text file using a program like WordPad and name it “htaccess.txt”. DO NOT use Microsoft Word or any other similar word processing program. These do not save documents as plain text.

Copy the following and and paste into your text document, replacing the http://my-new-domain.com/ with your new URL.
[php]
RedirectMatch permanent /.* http://my-new-domain.com/
[/php]

Upload the file to your site root and rename it to “.htaccess” (without quotes).

That’s all!

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.