Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-10-2013, 09:06 PM   #1
LQ Newbie
Registered: May 2013
Posts: 1

Rep: Reputation: Disabled
Creating 301 Permanent Redirect to a domain with same docroot as old domain.

Hello, this is my first post here. I did search the forums trying to find an answer, but nothing seemed to allay my fears of what I am about to do.

I am attempting to rebrand my sister's website to a new brand new domain name. But there is only the one docroot with all the pages. I want to create 301 redirects for each page to the new domain, but the problem is that I think if I change the .htaccess file in the docroot to redirect
(say /home/index.php to )
then that would send the site into weird a loop since it would just point back at the same docroot.

So.... My thought is that I need to create a brand new docroot folder with an .htaccess file containing all of my 301 redirects to the pages on the new domain. I will point the old website domain at that new docroot, and I will point the new domain at the old docroot.

Does that sound like the right approach?

All of the directory structure and pages under the docroot are the same as the old site. The site in question is an OpenCart site (PHP pages with parameters on the URLs).

So URLs are either like

My ultimate goal is to tell all search engines that the domain has changed permanently, and to also redirect the customers to the new store (hopefully to the same page they were trying to hit from Google). And hopefully not loose all the search engine stats accumulated by Google.

Is the RedirectPermanent the best directive for this?

Thanks for any help you can give,
Old 05-15-2013, 04:35 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,574

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
If your files/folder structure is going to remain identical then set your site up so that the new domain works, then add the following to your apache config either in the conf file for the new domain or as a separate vHost:

  RedirectMatch 301 (.*)$1
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub domain Redirect adam_1784 Linux - Software 2 01-16-2012 01:01 PM
redirect to decenter Linux - Server 4 09-13-2011 11:05 AM
[SOLVED] creating domain form vadddomain-domain doesnot exsist centos123 Linux - Server 1 05-07-2011 02:53 AM
IPtables - block subdomains (,,,...) benjalien Linux - Networking 6 06-24-2009 08:03 AM
redirect to macadam Linux - Newbie 2 05-15-2008 02:07 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration