Results 1 to 3 of 3

Thread: .htaccess rewriting

  1. #1
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default .htaccess rewriting

    Hi, I haven't really used htaccess rewrite before but I've been told it can do what I want.
    I'm currently using something which rewrites domain.com/xyz to domain.com/file.php?var=xyz
    however, what I wish to do is redirect xyz.domain.com to this instead, how would I do this?

    Thanks.

  2. #2
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    Code:
    RewriteEngine on
    RewriteCond %{REQUEST_URI} =/
    RewriteRule .* http://example.com/ [R,L]
    RewriteRule (.+) http://$1.example.com/ [R]
    If you go to example.org it redirects you to example.com
    If you go to example.org/hello it redirects you to hello.example.com

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, this is backwards to what I'd like to do;

    I'd like to redirect xyz.example.com to example.com/page.php?var=xyz

    If its just a simple rearrangement of that then I apologise, I don't know how to do it.
    Thank you.

Tags for this Thread

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
  •