Forum Moderators: phranque
# needs to stay inline
Options +Indexes +FollowSymlinks -MultiViews
Options -Indexes
RewriteEngine on
DirectoryIndex index.php
# REDIRECT Force requests for named index files to drop the index file filename, and force www to avoid redirect chains:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?|php[45]?)(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]*/)*)index\.(html?|php[45]?)$ http://www.domain.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+)/([^\.]+)\.php\ HTTP/
RewriteRule ^(en|de|ar)/([^.]+)\.php$ http://www.domain.com/$1/$2 [R=301,L]
# REDIRECT all non-canonical hostname requests to canonical hostname
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
# REWRITE url to filepath
RewriteRule ^(en|de|ar)/([^/.]+)$ /$1/$2.php [L]
# custom errorpages
ErrorDocument 404 /404.html
[edited by: tedster at 4:36 pm (utc) on Sep 30, 2010]
[edit reason] member requested fix [/edit]
RewriteCond %{HTTP_HOST} !^(www\.domain\.com)?$ [edited by: tedster at 4:37 pm (utc) on Sep 30, 2010]
[edit reason] member requested fix [/edit]