Question Asked: How Do I Redirect All My Webpages To My New Domain Name?

Comment On This »

Jun 29th, 2009

Changing your domain name can be a pain in the butt, especially if you have a lot of webpages with links in them.

The easiest thing to do is to use a “Redirect” rule, that is unless you prefer opening all of your pages and updating links by hand.  And of course, you can’t redirect traffic coming from search engines that way.  So we’ll proceed with a redirect.

If you already have an .htaccess file in your website’s top directory (ie; not in a folder), open it.  If you don’t, open NotePad or an equivilent text editor. Do not use WordPad.

Type the following in the document:

RedirectMatch 301 (.*) http://www.your-domain.com/$1

Replace “your-domain.com”, with what your new domain name is. Leave the $1 on the end.

Now save the document, and re-upload it to your server for your old domain name. (If you didn’t have an .htaccess file. Save the file as htaccess.txt. Upload it, then rename it to .htaccess once on your server.)

Now any request for any page on your old domain will redirect to the domain name you’ve specified. So mysite.com/this-webpage.html will redirect to mynewsite.com/this-webpage.html

Other answers you may find useful:


Previous Post

Next Post

« »


Comment On This Post

 

 

Ask MJ Your Question

Submit your question to Ask MJ and MJ will answer your question on the site, and email you to let you know it has been answered.