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

 

Link to comment
Share on other sites

  • 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

Link to comment
Share on other sites

  • 5 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.