Apache Documentation
Apache 1.3.3x
Apache 2.0.5x
Apache Setup
Apache 1.3.3x
Apache 2.0.5x
Various other
Apache Links
FreeBSD
vi
Home
Rewrite solutions
:
site.com becomes www.site.com
RewriteEngine On RewriteCond %{HTTP_HOST} !^www.domain.net [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.domain.net/$1 [L,R]
site.com becomes www.site.com
RewriteEngine On RewriteCond %{HTTP_HOST} !=www.domain.net [NC] RewriteRule ^ http://www.domain.net%{REQUEST_URI} [R,L]
hotlinking and give an image
RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://%{HTTP_HOST}.*$ [NC] RewriteRule \.(gif|jpg)$ http://www.anothermydomain.com/nasty.gif [R,L]
Stop hotlinking and give a image
RewriteEngine on RewriteCond %{HTTP_REFERER} ^$ [OR] RewriteCond %{HTTP_REFERER} !^http://(www\.)?(domain1|domain2)\.org.*$ [NC] RewriteRule \.(gif|jpg)$ http://some-other-site.com/images/donthotlinkme.jpg [R,L]
RewriteEngine on RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ RewriteRule ^(.+)$ /home/%1/public_html$1
send http://site.com and http://www.site.com to https://site.com
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC] RewriteRule ^ https://secure.domain.com/domain.com%{REQUEST_URI} [R,L]