Forum Moderators: phranque
DirectoryIndex /index.php
#
Options +FollowSymLinks -MultiViews
AcceptPathInfo off
RewriteEngine on
#
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/?\ ]*/)*[^/.?\ ]+\.(php|html)(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]*/)*[^/.]+)\.(php|html)$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(([^/]*/)*[^/.]+)$ /$1.php [L]
#
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(([^/]*/)*[^/.]+)$ /$1.html [L]
#
ErrorDocument 400 /index.php?page=error&action1=400
ErrorDocument 401 /index.php?page=error&action1=401
ErrorDocument 403 /index.php?page=error&action1=403
ErrorDocument 404 /index.php?page=error&action1=404
ErrorDocument 500 /error500.html
RewriteRule ^(((([^/]+)/[^/]+)/[^/]+))/[^/]+)/$ http://www.example.com/$1 [R=301,L]
if(!preg_match('/^([^\.]+)\.([a-z0-9]{3,4})$/i', $_SERVER['REQUEST_URI')) {
// Rewrite
} else {
// Allow
}
# Redirect to remove trailing slashes from all non-directory URLs without a "file extension"
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(([^/]+/)*[^/.]+)/$ http://www.example.com/$1 [R=301,L]
#
# Rewrite all requested URLs without trailing slashes or file extensions to the index.php script
RewriteRule ^(([^/]+/)*[^/.]+)$ index.php?url-path=$1 [L]
RewriteRule ^([^/]+)/([^/]+)/([^/.]+)$ /index.php?page=$1&action1=$2&action2=$3
RewriteRule ^([^/]+)/([^/.]+)$ /index.php?page=$1&action1=$2
RewriteRule ^([^/.]+)$ /index.php?page=$1