Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 5 of 5

This is a discussion on Auto subdomain with mod_rewrite in the Shared & Semi-Dedicated forum
I want to make script based subdomains without adding from cpanel. I mean: www.domain.com/user.php?name=ozz address invisibly redirects to: ozz.domain.com I did so many tries on ...

  1. #1
    Ozz
    Ozz is offline
    JPC Member
    Join Date
    Jan 2006
    Posts
    12

    Question Auto subdomain with mod_rewrite

    I want to make script based subdomains without adding from cpanel.
    I mean:
    www.domain.com/user.php?name=ozz
    address invisibly redirects to:
    ozz.domain.com
    I did so many tries on htaccess with mod_rewrite and some changes httpd configuration made wildcard enabled but every subdomains goes to my domain's main index page.
    Can you help me whats wrong with that?

    I cant place a support ticket I only think maybe someone needed it too or made it.

  2. #2
    JPC Member
    Join Date
    Jan 2006
    Posts
    13
    <Disclaimer - I have drunk much beer prior to this post>

    I haven't written a rewrite for a while.

    In the most simple case I would use something like this.

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
    RewriteRule ^(.*)$ /user.php?name=%1 [L]
    I would suggest you post your rewrite script here so we can look at it an pick it apart.

    If you haven't included the Options +FollowSymLinks line then I would include it. (Dunno if symlinks is on or off by default, but it never hurts to make sure?)

  3. #3
    Ozz
    Ozz is offline
    JPC Member
    Join Date
    Jan 2006
    Posts
    12
    That gives 503 error on all pages VangariDei.
    I use this htaccess:
    Code:
    <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^\.htaccess$ - [F]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^tag/(.*)/$ search.php?fields=link&q=$1
    RewriteRule ^tag/(.*)$ search.php?fields=link&q=$1
    </IfModule>
    I put yours after RewriteEngine on:
    Code:
    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
    RewriteRule ^(.*)$ /user.php?name=%1 [L]
    And give Internal Server Error on all pages

  4. #4
    consultant Andre's Avatar
    Join Date
    Apr 2005
    Posts
    1,155
    Ozz just one question:

    You said you want it to invisbly redirect to ozz.domain.com. Do you mean that you want www.domain.com/user.php?name=ozz to keep appearing in the browser's address?

    Because if not, you could use a simple PHP script like:

    Code:
    <?
    header("Location: http://$name.domain.com");
    ?>
    Andre van Vliet

    DEHE.com - Definition of Hosting Experts

  5. #5
    Ozz
    Ozz is offline
    JPC Member
    Join Date
    Jan 2006
    Posts
    12

    Question

    Well I dont want to long url shown in address bar, user types ozz.domain.com address bar must stay ozz.domain.com. I mean that, as invisible.

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
  •