Page 1 of 1

using .htaccess

Posted: Wed Feb 16, 2011 1:49 am
by ganesh_dabhade
Hi friends, I m new to .htaccess and I need ur help in this problem

I want to access http://www.mysite.com/index.php?user=testuser as http://testuser.mysite.com/index.php
(these urls are for informative purpose only.)

I know this can be done using .htaccess readwrite rules.
Whenever a user registers, he should have its own subdomain.

please help me
thanks!

Re: using .htaccess

Posted: Wed Feb 16, 2011 2:29 pm
by tr0gd0rr
If all the subdomains point to the same web root, you may be able to put HTTP_HOST as a get param. Something like this?

Code: Select all

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ $1?user=%{HTTP_HOST} [QSA,L]
That would set user = "testuser.mysite.com"

Not sure if that would work.

Re: using .htaccess

Posted: Sun Feb 20, 2011 2:38 am
by ganesh_dabhade
I have used
RewriteEngine On
RewriteRule ^([^/]+) /info.php?b=$1
It worked. But now I am not able to view my index.php file at the root. Instead It shows above page with b is equal to nothing.

Please help me solve this.