Solved

Simple htaccess redirection

Posted on 2010-11-09
2
355 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now