alexweber15 Posted April 1, 2009 Share Posted April 1, 2009 searched both the forums and google and haven't found anything that works... here's the deal (and i can see this is pretty popular too): URL: one.mydomain.test REDIRECT: mydomain.test/redir.php?sub=one and so on... whatever the subdomain used i want it to be passed as a GET variable to the file redir.php i'm running xampp on windows and i've already set up a virtual host and enabled ServerAlias *.mydomain.test and www.mydomain.test works fine here's my htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mydomain\.test RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain\.test RewriteRule ^(.*)$ /redir.php?sub=%1 [R,L] whenever i try to access any subdomain (or even just mydomain.test - without the www) i get a page not found error... can anyone please help? Quote Link to comment https://forums.phpfreaks.com/topic/152019-solved-fake-subdomains/ Share on other sites More sharing options...
emma57573 Posted April 5, 2009 Share Posted April 5, 2009 This is what I used for my fake subdomains and it works I had to get my hosting company to set up a wildcard on the server for it to work though. RewriteCond %{HTTP_HOST} ([^/]+).mydomain.co.uk [NC] RewriteCond %1 !www$ [NC] RewriteRule ^(.*)$ http://www.mydomain.co.uk/some_page.php?variable=%1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/152019-solved-fake-subdomains/#findComment-801640 Share on other sites More sharing options...
alexweber15 Posted April 6, 2009 Author Share Posted April 6, 2009 thanks for the replies, someone on another forum showed me a link that solved my problem someone should sticky this... using mod_rewrite for fake subdomains Quote Link to comment https://forums.phpfreaks.com/topic/152019-solved-fake-subdomains/#findComment-801944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.