/ Published in: Apache
                    
                                        
A default HTAccess file. Uncomment any lines that you want to use.
http://enarion.net/web/htaccess/trailing-slash/
                http://enarion.net/web/htaccess/trailing-slash/
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<FilesMatch ".(ini)$">
Order allow,deny
deny from all
</FilesMatch>
Options +FollowSymlinks
Options All -Indexes
RewriteEngine on
#########################################
# rewrite all non www urls to www urls
#########################################
RewriteCond %{HTTP_HOST} !^www.sitename.com$
RewriteRule ^(.*)$ http://www.sitename.com/$1 [R=301,L]
#########################################
# add trailing slashes to directories
#########################################
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://sitename.com/$1/ [L,R=301]
#########################################
# 404 page
#########################################
ErrorDocument 404 /404.php
#########################################
# 301 Redirects
#########################################
redirect 301 /old/old.htm http://www.sitename.com/new/new.htm
#########################################
# secure pages
#########################################
#RewriteCond %{REQUEST_URI} /cart.php [OR]
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^(.*)$ https://www.sitename.com/$1 [R,L]
#########################################
# unsecure pages
#########################################
#RewriteCond %{REQUEST_URI} /products [OR]
#RewriteCond %{SERVER_PORT} 443
#RewriteRule ^(.*)$ http://www.sitename.com/$1 [R,L]
Comments
 Subscribe to comments
                    Subscribe to comments
                
                