FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Skeleton .htaccess file for Powweb Hosting

Powweb Web Hosting One thing that can come in reallly handy if you are in charge of mutliple websites, often adding new ones is a template .htaccess file. Especially for a webhost like Powweb, which is perfect for ordinary people who want a web site. Normally I would recommend DreamHost, but maybe more on that later.

A .htaccess Template For Powweb

Pretty short and to the point, mostly useful for newcomers to apache to have a system whereby they know where stuff should go and how it goes together. This is how I like to do it on Powweb.

Download .htaccess file

  1. Powweb .htaccess
  2. htaccess-sample
#> https://www.askapache.com/htaccess/


##############################################
#            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/Las_Vegas
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 https://www.askapache.com/htaccess/
Redirect 301 /awkl https://www.askapache.com/awk/awk-tutorial/
Redirect 301 /ben.html https://www.askapache.com/wordpress/best-adsense-optimization/
Redirect 301 /commonly-s.html https://www.askapache.com/htaccess/commonly-used-htaccess-code-examples/
Redirect 301 /css-backgro https://www.askapache.com/css/css-background-image-sprite/
Redirect 301 /htacce https://www.askapache.com/htaccess/feedsmith-htaccess/


### PERMANENT REDIRECTMATCH ###
RedirectMatch 301 ^/([(]+)(.*)$ https://www.askapache.com/
RedirectMatch 301 ^/(.+).htm$ https://www.askapache.com/$1.html
RedirectMatch 301 ^/(.+).html/$ https://www.askapache.com/$1.html
RedirectMatch 301 ^/(.+)/.html$ https://www.askapache.com/$1/
RedirectMatch 301 ^/&(.*)$ https://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 ^/(.*)//(.*)$ https://www.askapache.com/$1/$2
RedirectMatch 307 ^//(.*)$ https://www.askapache.com/$1
RedirectMatch 307 ^/(.*)askapache(.*)askapache(.*)$ https://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


#> https://www.askapache.com/htaccess/
#            DEFAULT SETTINGS                #
##############################################
Options +All +ExecCGI -Indexes
DirectoryIndex index.html index.php
SetEnv TZ America/Las_Vegas
#SetEnv SERVER_ADMIN webmaster@askapache.com
ServerSignature Off
#
AddType video/x-flv .flv
AddType application/x-shockwave-flash .swf
AddType image/x-icon .ico
#
#AddHandler php-cgi .php
#Action php-cgi /cgi-bin/php5.cgi
#

AddDefaultCharset utf-8
DefaultLanguage en-us



AuthName "Blog"
Require user admin
AuthUserFile /web/users/web/b646/pow.askapache/.htpasswd
AuthType basic


#                  CACHING                   #
##############################################
#   YEAR

Header set Cache-Control "max-age=29030400"

#   MONTH

Header set Cache-Control "max-age=2592000"

#   HOUR

Header set Cache-Control "max-age=3600"

Htaccess Htaccess Powweb skeleton

 

 

Comments