Jump to content

How to create a virtual subdomain using .htaccess


gdhanasekar

Recommended Posts

Hi all,

 

I need to know the details for to creating the virtual sub domains (like http://user.domain.com).

I found that , we need wild card dns facility for hosting account in order to create such virtual sub domains.

I have enabled the wild card dns feature in my hosting but I dont know how to create this.

I have to create the virtual sub domains for my website.

i.e. http://www.mydomain.com/profile.php?mid=screenname to

    http://screenname.mydomain.com

 

if anyone knows this, please post it.

 

Thanks and Regards!!!

gdhanasekar

 

  • 3 weeks later...
  • 1 year later...

this is what i am doing:

 

RewriteCond %{HTTP_HOST} !^www\.example\.com

RewriteCond %{HTTP_HOST} ([^.]+)\.example\.com [NC]

RewriteRule ^(.*)$ http://www.example.com/controller/action/%1 [L]

 

My problem is the page is getting changed along with the URL. I dont want to the URL to get changed. What should i do. Please help :(

 

and if i change

 

RewriteRule ^(.*)$ http://www.example.com/controller/action/%1 [L]

as

RewriteRule ^(.*)$ /controller/action/%1 [L]

 

Its giving Internal Server Error. Please help.

 

Thanks

 

 

 

 

 

 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.mydomain.com
RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain.com
RewriteRule ^(.*)$ /profile.php?mid=%1

  • 5 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.