SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sudomain ModRewrite?

    Just a question... can modrewrite redirect anything.domain.com to domain.com/anything (or domain.com/index.php?id=anything) without having to add all the sub domains? If so, do you have some sample expressions or tutorials on it? Thanks.

  2. #2
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The answer is yes.

    >> anything.domain.com
    >> to domain.com/anything
    /.htaccess
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
    RewriteCond %1 !^www$ [NC]
    RewriteRule ^$ /%1 [L]
    >> anything.domain.com
    >> to domain.com/index.php?id=anything
    /.htaccess
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
    RewriteCond %1 !^www$ [NC]
    RewriteRule ^$ /index.php?id=%1 [L]



    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  3. #3
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NICE! Thanks pippo, I was hoping you'd come across the thread! Thank very much.

    Can I have a full URL in the last statement? Or does it have to be relative.

  4. #4
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, I have:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^([^.]+)\.artorg\.co\.uk$ [NC]
    RewriteCond %1 !^www$ [NC]
    RewriteRule ^$ /v3/member.php?id=%1 [L]
    And I go to test.artorg.co.uk and it says it cannot be resolved... any ideas why this is?


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
  •