Jump to content

subdomain problem


robert_gsfame

Recommended Posts

i want to create a virtual subdomain using rewrite url

 

<IfModule mod_rewrite.c>

Options +FollowSymLinks

Options +Indexes

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !www.mydomain.com.th$ [NC]

RewriteCond %{HTTP_HOST} ^([a-z0-9-]+).mydomain.com.th [NC]

RewriteRule (.*) mypage.php?username=%1 [L]

RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain\.com\.th

RewriteRule ^/?([.*]+)?$ /page_error.html

</IfModule>

ErrorDocument 404 /page_error.html

 

the problem is that when i try to call the subdomain  blabla.mydomain.com.th, i immediately get redirected to cgi-sys/defaultwebpage.cgi, even if the username exist...

 

any solution for this?

 

thx a lot!

 

thx

Link to comment
Share on other sites

I don't mean to regurgitate solutions but try this:

 

Try this in your htaccess, but make sure your website apache server and wildcard DNS is switched on in your server:

 

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

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

RewriteRule ^(.*)$ http://www.example.com/page.php?%1 [L]

 

hope this helps

 

-enjoy coding

 

Source: http://forums.westhost.com/showthread.php?t=7338

Link to comment
Share on other sites

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.