.htaccess cook book, examples, and favourites
All of My Favourite .HTAccess Examples Wildcard Domain Example #1 This will take your URL request, for anything.dummysite.com and redirect to dummysite.com/anything/index.html. Combined with an CNAME Record for @ #### URL Rewrite Handler for Subdomains (by Randall Krause) #### RewriteCond %{HTTP_HOST} !^www\.dummysite\.com$ RewriteCond %{HTTP_HOST} ^(\w+)\.dummysite\.com$ RewriteCond %{REQUEST_URI}:%1 !^/([^/]+)/([^:]*):\1 RewriteRule ^(.*)$ /%1/$1 [QSA] Wildcard Domain Example #2 What this does is if user visits: test.example.com, it will show contents of file: example.com/user/profile.php?name=test. If someone goes to lol.example.com, it will show page: example.com/user/profile.php?name=lol but the URL will remain the same with the subdomain, like test.example.com and lol.example.com. RewriteCond %{HTTP_HOST} !^www\.example\.com RewriteCond %{HTTP_HOST} ([^.]+)\.example\.com [NC] RewriteRule ^/?$ /user/profile.php?name=%1 [L] Single Argument Example ## example: http://dumm...