biswarup Posted October 15, 2011 Share Posted October 15, 2011 (anything).example.com/(anything) to example.com/(anything) for example : img1.example.com/test1.jpg to example.com/test1.jpg img105.example.com/anotherimage.png to example.com/anotherimage.png tdr.example.com/a.css to example.com/a.css Quote Link to comment https://forums.phpfreaks.com/topic/249186-redirect-all-subdomain-url-to-specific-url-using-htaccess/ Share on other sites More sharing options...
cags Posted October 17, 2011 Share Posted October 17, 2011 First you need to set-up wildcard subdomains on your DNS. Assuming this is done, something like this should work... RewriteCond %{HTTP_HOST} !example.com RewriteRule .* http://example.com/%{REQUEST_URI} [R=302] Once you're happy it's working you can switch the 302 to 301. Quote Link to comment https://forums.phpfreaks.com/topic/249186-redirect-all-subdomain-url-to-specific-url-using-htaccess/#findComment-1279875 Share on other sites More sharing options...
biswarup Posted October 17, 2011 Author Share Posted October 17, 2011 its not working....... Quote Link to comment https://forums.phpfreaks.com/topic/249186-redirect-all-subdomain-url-to-specific-url-using-htaccess/#findComment-1279877 Share on other sites More sharing options...
cags Posted October 17, 2011 Share Posted October 17, 2011 sucks to be you... Quote Link to comment https://forums.phpfreaks.com/topic/249186-redirect-all-subdomain-url-to-specific-url-using-htaccess/#findComment-1280010 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.