htaccess - redirect site.com/abc to abc.site.com

Discussion in 'Apache' started by Kerosene, May 28, 2008.

  1. #1
    I've got a few pages that have moved from
    domain.com/directory/
    to
    directory.domain.com/

    How can I redirect anything with "/directory" in the url to directory.domain.com?
    I'm not worried about individual pages, but I want anyone using the old directory url to end up on the subdomain.
    I'm also not worried about SEO implications (for once).

    e.g
    domain.com/directory/ >>> directory.domain.com
    domain.com/directory/blabla/ >>> directory.domain.com
    domain.com/directory/blabla/html >>> directory.domain.com
     
    Kerosene, May 28, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    This should suit your needs:

    RewriteEngine On
    RewriteRule ^(.*?)/.*$ http://$1\.pastebin\.com [R]
    Code (markup):
    It redirects the directory to pastebin for now, just so you can see it works :) Rep greatly appreciated.

    Jay
     
    jayshah, May 28, 2008 IP