Solved

htaccess file

Posted on 2014-04-23
4
381 Views
Last Modified: 2014-04-23
I am moving domains.  On the old domain I created an htaccess file with the following contents only:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^old.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.old.com$
RewriteRule (.*)$ http://www.new.com/$1 [R=301,L]

Is this correct?  Should I have any other code or text int he file?
0
Comment
Question by:a204801
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Insoftservice earned 500 total points
ID: 40018156
Its correct you could even try this one

RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
0
 

Author Comment

by:a204801
ID: 40018163
Im trying to preserve the existing link structure.  So if they go to

old.com/why/because

they end up on

new.com/why/because

Not to mention, if they go to www.old.com or old.com, they get forwarded to www.new.com
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 40018178
what you want actually .
As your htacces says that it has to redirect to new one
please elaborate your reuirement
0
 

Author Comment

by:a204801
ID: 40018419
I believe I figured out the issue.  I had the DNS host pointing towards the correct spot, but I didn't realize that www, via CNAME, was still pointing towards the old host.  I have rectified the mistake.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmakerā€¦
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question