robert_gsfame Posted August 25, 2010 Share Posted August 25, 2010 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 https://forums.phpfreaks.com/topic/211707-subdomain-problem/ Share on other sites More sharing options...
cliffdodger Posted August 25, 2010 Share Posted August 25, 2010 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 https://forums.phpfreaks.com/topic/211707-subdomain-problem/#findComment-1103732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.