SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Location
    Buffalo Grove, Illinois
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Use .htaccess - Create wildrange subdomains

    I've found this .htaccess code very useful. Creates wild range subdomains. Hope you find some use for it!

    Code:
    RewriteEngine On
    Options +FollowSymLinks +Execcgi +Indexes
    
    RewriteCond %{HTTP_HOST} !^www.yourdomain\.com [NC]
    RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).yourdomain\.com [NC]
    RewriteRule ^$ /content.php?title=%2 [L]
    ~Cheers
    Kyle Eagle
    President and Founder
    eWeb Services Inc.
    http://eWebServicesInc.com

  2. #2
    Non-Member thewebhostingdir's Avatar
    Join Date
    Oct 2005
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It must be needing the wide card records for the domain added. Moreover, is it working if the Wild card VirtualHost is not added?

  3. #3
    SitePoint Zealot Bompa's Avatar
    Join Date
    Feb 2008
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by eWebServicesInc View Post
    I've found this .htaccess code very useful. Creates wild range subdomains. Hope you find some use for it!

    Code:
    RewriteEngine On
    Options +FollowSymLinks +Execcgi +Indexes
    
    RewriteCond %{HTTP_HOST} !^www.yourdomain\.com [NC]
    RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).yourdomain\.com [NC]
    RewriteRule ^$ /content.php?title=%2 [L]
    ~Cheers
    Thanks for sharing, but .htaccess can NOT create wild card sub domains. That can only
    be done in the httpd.conf file.

    Your code only handles the subs later.

    Bompa


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
  •