#> http://www.askapache.com/htaccess/apache-htaccess.html <# ############################################## # DEFAULT SETTINGS # ############################################## Options +All +ExecCGI -Indexes DirectoryIndex index.html index.php /index.php ### MEDIA TYPES ### AddType video/x-flv .flv AddType application/x-shockwave-flash .swf AddType application/octet-stream .chm .bz2 AddType application/vnd.ms-excel .csv AddType application/x-pilot .prc .pdb AddType application/x-gzip .gz AddType image/x-icon .ico ### CHARSET LANG ### DefaultType text/html AddDefaultCharset utf-8 AddLanguage en-us .html .htm .php .xml ### SETUP ENV ### SetEnv TZ America/Indianapolis SetEnv SERVER_ADMIN webmaster@site.com ServerSignature off ### ERRORDOCUMENTS ### ErrorDocument 206 /ERROR/206.html ErrorDocument 401 /ERROR/401.html ErrorDocument 403 /ERROR/403.html ErrorDocument 404 /ERROR/404.html ErrorDocument 500 /ERROR/500.html ############################################## # HEADERS and CACHING # ############################################## #### CACHING #### ExpiresActive On ExpiresDefault A3600 # 1 MONTH ExpiresDefault A2419200 Header append Cache-Control "public" # 2 HOURS ExpiresDefault A7200 Header append Cache-Control "private, must-revalidate" # NEVER CACHE ExpiresDefault A0 Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" Header set Pragma "no-cache" ############################################## # MOD_ALIAS REDIRECTS # ############################################## #### PERMANENT REDIRECTS #### Redirect 301 /all.html http://www.askapache.com/htaccess/apache-htaccess.html Redirect 301 /awkl http://www.askapache.com/awk/awk-tutorial.html Redirect 301 /ben.html http://www.askapache.com/wordpress/best-adsense-optimization.html Redirect 301 /commonly-s.html http://www.askapache.com/htaccess/commonly-used-htaccess-code-examples.html Redirect 301 /css-backgro http://www.askapache.com/css/css-background-image-sprite.html Redirect 301 /htacce http://www.askapache.com/htaccess/feedsmith-htaccess.html ### PERMANENT REDIRECTMATCH ### RedirectMatch 301 ^/([\(]+)(.*)$ http://www.askapache.com/ RedirectMatch 301 ^/(.+)\.htm$ http://www.askapache.com/$1.html RedirectMatch 301 ^/(.+)\.html/$ http://www.askapache.com/$1.html RedirectMatch 301 ^/(.+)/\.html$ http://www.askapache.com/$1/ RedirectMatch 301 ^/&(.*)$ http://www.askapache.com/ #### TEMPORARY REDIRECTS #### Redirect 307 /about/feeds/ http://feeds.askapache.com/apache/htaccess Redirect 307 /about/feeds/it/ http://feeds.askapache.com/apache/htaccess Redirect 307 /apachesearch/ http://google.com/coop/cse?cx=002660089121042511758%3Akk7rwc2gx0i Redirect 307 /apachecsetest/ http://google.com/coop/cse?cx=002660089121042511758%3Akk7rwc2gx0i #### TEMPORARY REDIRECTMATCH #### RedirectMatch 307 ^/(.*)//(.*)$ http://www.askapache.com/$1/$2 RedirectMatch 307 ^//(.*)$ http://www.askapache.com/$1 RedirectMatch 307 ^/(.*)askapache(.*)askapache(.*)$ http://www.askapache.com/ ############################################## # MOD_REWRITE REWRITES # ############################################## RewriteEngine On RewriteBase / ### REQUIRE WWW ### RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC] RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L] ### CACHEABLE FILES RewriteRule ^z/j/site-([0-9]+)\.js$ /z/j/site.js [L] RewriteRule ^z/c/site-([0-9]+)\.css$ /z/c/site.css [L] ############################################## # MOD_SETENVIF VARIABLES # ############################################## SetEnvIfNoCase Remote_Host "(.*)" ASKAPACHE_HOST=$1 SetEnvIfNoCase Remote_Addr "(.*)" ASKAPACHE_REMOTE_ADDR=$1 SetEnvIfNoCase Server_Addr "(.*)" ASKAPACHE_SERVER_ADDR=$1 SetEnvIf Request_Method "(.*)" ASKAPACHE_REQUEST_METHOD=$1 SetEnvIf Request_Protocol "(.*)" ASKAPACHE_REQUEST_PROTOCOL=$1 SetEnvIf Request_URI "(.*)" ASKAPACHE_REQUEST_URI=$1 SetEnvIf Remote_Addr 208\.113\.183\.103 REMOTE_HOST=www.askapache.com #> http://www.askapache.com/htaccess/apache-htaccess.html <#