Guide of lazy programmer who don't like thinking :)
ex. subdomains/www =» www.example.com subdomains/better =» better.example.com
RewriteEngine on # redirect if no sub-domain RewriteCond %{HTTP_HOST} ^([^.]+).([^.]+)$ [NC] RewriteRule ^(.*)$ http://www.%1.%2/$1 [R,L] # redirect domains RewriteCond %{REQUEST_URI} !^/subdomains RewriteCond %{HTTP_HOST} ^([^.]*).?([^.]+).([^.]+)$ [NC] RewriteRule ^(.*)$ /subdomains/%1/$1 # fix trailing slash RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])$ $1/ [L]
Name (required)
Mail (will not be published) (required)
Website
Leave a Comment