Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

htaccess file

Posted on 2014-04-23
4
Medium Priority
?
397 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 1500 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

927 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