mostafa.fayyaz Posted August 14, 2009 Share Posted August 14, 2009 hello ! i want to redirect all subdomains to show.php. for example : test.mydomain.info to show.php?url=test i want to use .htaccess file . but it does't work plase help me Quote Link to comment https://forums.phpfreaks.com/topic/170313-redirect-subdomain-to-a-php-file/ Share on other sites More sharing options...
oni-kun Posted August 15, 2009 Share Posted August 15, 2009 You'll need to use your .htaccess like this.. RewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain\.example\.com RewriteRule ^(.*)$ http://example.com/show.php?url=test [R] If you want... test4.example.com to = show.php?url=test4.. RewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain\.example\.com RewriteRule ^(.*)$ http://example.com/subdomain$1 [R] Quote Link to comment https://forums.phpfreaks.com/topic/170313-redirect-subdomain-to-a-php-file/#findComment-898564 Share on other sites More sharing options...
mostafa.fayyaz Posted August 15, 2009 Author Share Posted August 15, 2009 You'll need to use your .htaccess like this.. RewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain\.example\.com RewriteRule ^(.*)$ http://example.com/show.php?url=test [R] If you want... test4.example.com to = show.php?url=test4.. RewriteEngine On RewriteCond %{HTTP_HOST} ^subdomain\.example\.com RewriteRule ^(.*)$ http://example.com/subdomain$1 [R] i used this code , but doesn't work . Server not found Quote Link to comment https://forums.phpfreaks.com/topic/170313-redirect-subdomain-to-a-php-file/#findComment-898652 Share on other sites More sharing options...
abazoskib Posted August 22, 2009 Share Posted August 22, 2009 i used this code in my httpd.conf file because i do not allow .htaccess. it isnt working. Quote Link to comment https://forums.phpfreaks.com/topic/170313-redirect-subdomain-to-a-php-file/#findComment-903854 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.