Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

rewrite engine - sub domains / directories

Discussion in 'General Discussion' started by AlaskanWolf, Dec 20, 2002.

  1. AlaskanWolf

    AlaskanWolf Well-Known Member

    Joined:
    Aug 11, 2001
    Messages:
    537
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    Fremont CA
    Im trying to get this to work

    http://domain.com/members/USER

    to become

    http://USER.domain.com

    i got the code below but it doesnt work, i also added a wild card to dns. All i get is the apache page.

    The only way we got this to work is with http://www.domain.com, in that case it does forward to /home/user-directory/www/members/www

    Anyone got any ideas??

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.|^([a-z0-9-]+)\.userdomain\.com$
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
    RewriteRule ^([a-z0-9-]+)\.userdomain\.com/(.*) /home/user/public_html/members/$1/$2
    RewriteRule ^www\.([a-z0-9-]+)\.usterdomain\.com/(.*) /home/user/public_html/members/$1/$2
     
  2. AlaskanWolf

    AlaskanWolf Well-Known Member

    Joined:
    Aug 11, 2001
    Messages:
    537
    Likes Received:
    0
    Trophy Points:
    316
    Location:
    Fremont CA
    this is how pathedic us admins are....laying in bed last night ready to doze off, i said to myself & what if i have to add a ServerAlias tag to it&

    sure enought...works great now

    heres the code for everyone to enjoy


    &VirtualHost ip-add&
    ServerAdmin webmaster@youruserdomain.com
    DocumentRoot /home/dsshost/public_html
    BytesLog domlogs/youruserdomain.com-bytes_log
    ServerName www.youruserdomain.com
    ServerAlias youruserdomain.com www.youruserdomain.com *.youruserdomain.com
    CustomLog domlogs/youruserdomain.com combined
    ScriptAlias /cgi-bin/ /home/dsshost/public_html/cgi-bin/


    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^[^.]+\.youruserdomain\.com$
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
    RewriteRule ^([^.]+)\.youruserdomain\.com(.*) /directory/$1$2

    &/VirtualHost&
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice