Skip to content

Instantly share code, notes, and snippets.

@maagmirror
Created January 10, 2016 01:23
Show Gist options
  • Save maagmirror/c8e1bc9a5f95d371745c to your computer and use it in GitHub Desktop.
Save maagmirror/c8e1bc9a5f95d371745c to your computer and use it in GitHub Desktop.
# Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
RewriteBase /
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^maag.hol.es
RewriteRule ^ http://www.maag.hol.es%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
<FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
Options All -Indexes
ErrorDocument 404 /404.php
ErrorDocument 400 /404.php
ErrorDocument 401 /404.php
ErrorDocument 403 /404.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment