SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    301 redirect from subdirectory to new domain

    Hi guys

    Ive hit a problem here and cant seem to find a way out

    I have a site that started life as a subdirectory of a domain.

    http://www.hostdomain.com/mysite

    This little site has grown quite large and has a good SEO and link basis built up over the last couple of years, I decided to split it into a domain in its own right on a seperate server.

    http://www.mysite.com

    So I want to 301 redirect all traffic that went to the original location to the new location, I have over 500 pages on the site so a htaccess file for file would be tedious, but when I try a rewrite, I keep getting the 'mysite' subdirectory appended to the mysite address. Like www.mysite.com/mysite/file.php

    Can anyone help please
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Mandes,

    Apache's mod_alias (the Redirect family of directives is part of the Apache core) is the ideal tool for you! Simply put this in the .htaccess of the OLD website:
    Code:
    Redirect 301 /mysite http://www.mysite.com
    With the 301 status, it will update the SE's and you'll not lose your rankings.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much, I can believe I didnt get to that simple result after all the possibilities I tried.

    It works wonderfully, thanks again
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,644
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Mandes,

    Yes, Apache is WONDERFUL (and quite powerful)!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •