aliento Posted September 24, 2011 Share Posted September 24, 2011 Hello, I have a folder 'dir' with folders for every country like us , uk , de etc i want the sub domain de.domain.com read from http://www.domain.com/dir/de/ etc. But the url will be de.domain.com. Can i do it with htaccess and how ? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/247782-htacces-question/ Share on other sites More sharing options...
cags Posted September 25, 2011 Share Posted September 25, 2011 Firstly I'll assume your DNS settings are setup correctly to allow the subdomains to get forwarded to your VirtualHost, if that is the case then you do something along the lines of... RewriteEngine On RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com RewriteRule ^(.*)$ /dir/%1/$1 Quote Link to comment https://forums.phpfreaks.com/topic/247782-htacces-question/#findComment-1272623 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.