Solved

htaccess file

Posted on 2014-04-23
4
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Plug and play, no additional software required!

The ATEN UE3310 USB3.1 Gen1 Extender Cable allows users to extend the distance between the computer and USB devices up to 10 m (33 ft). The UE3310 is a high-quality, cost-effective solution for professional environments such as hospitals, factories and business facilities.

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
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 dynamically set the form action using jQuery.

623 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