mod_rewrite - creating subdomains.. help!

Discussion in 'Apache' started by joshm, Apr 29, 2006.

  1. #1
    Hi,

    I want to make subdomain urls for query strings - I will try to explain...

    This is what I have been trying in my .htaccess file (in root directory):

    RewriteEngine on
    RewriteRule ^http://(www\.)?(.*)\.mydomain\.com/more/folders/$ /index.php?q=$1

    As you can see above, I want the query to be the subdomain - eg: say somebody searches for "query" (/index.php?q=query), then the rewritten url should be something like http://query.mydomain.com/more/folders/

    I think the problem i'm having is that it appears to be ignoring the subdomain part and looking at it as http://mydomain.com/more/folders/ therefore saying page not found when I click on a renamed url.

    Any help much appreciated,

    -Josh
     
    joshm, Apr 29, 2006 IP