RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/example/
RewriteCond %{REQUEST_URI} !^/cgi-bin/awstats.pl
RewriteCond %{HTTP_HOST} ^(www\.)?example_domain
RewriteRule ^(.*)$ example/$1 [L]
Lets break that down.
- RewriteCond %{REQUEST_URI} !^/example/
- Example should be the folder that you want to rewrite to. Not having this causes a loop
- RewriteCond %{HTTP_HOST} ^(www\.)?example_domain
- Examplle_domain is your real domain, without the end TLD (.com, .net, .whatever)
- This isn't needed per say, but if you have multiple domains going to different directories, it helps.
- RewriteRule ^(.*)$ example/$1 [L]
- Again, this is the folder that you want to rewrite to.