Solved

Simple htaccess redirection

Posted on 2010-11-09
2
361 Views
Last Modified: 2012-05-10
Hi Guys,
Quick and easy one (I think!) for someone who knows what they are doing!

I need to redirect our .org domain to the .com domain, but without all .org pages going to the .com index.

For example, I need www.xyz.org to go to www.xyz.com but also www.xyz.org/folder/index.php to go to www.xyz.com/folder/index.php

The directory structure is identical on both domains (which are on separate servers), and we're moving the .com domain.  I'm getting lost in .htaccess can anyone help?  Also need the code the deal with URLs with and without the www part.

Any thoughts?
0
Comment
Question by:lynxIT
[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 Comments
 
LVL 1

Accepted Solution

by:
MountMann earned 250 total points
ID: 34097953
You can use mod_rewrite for this, see the example of an .htaccess below.
RewriteCond %{HTTP_HOST} ^www.xyz.org$ [NC]
RewriteRule ^(.*)$ http://www.xyz.com/$1 [R=301,L]

Open in new window

0
 
LVL 1

Author Comment

by:lynxIT
ID: 34098289
Thats great - thanks

I've just realised that although the folder structure is the same its all within a html directory, so I'm guessing I could change:

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

to

RewriteRule ^(.*)$ http://www.xyz.com/home/$1 [R=301,L]

and it would work?
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

738 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