Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.info [nc]
RewriteRule (.*) http://www.domain.info/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
RewriteCond $1 !^forum/adm/
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*(index\.php)?\?[^\ ]*\ HTTP/
RewriteRule ^(([^/]+/)*)(index\.php)?$ http://www.domain.info/$1? [R=301,L]
# return an external permanent redirect to the www subdomain if a request is made without the www
# This "canonicalizes" your domain, which is good
RewriteCond %{HTTP_HOST} ^domain\.info [nc]
RewriteRule (.*) http://www.domain.info/$1 [R=301,L]
# If the full orignal request starts with from 3 to 9 upper-case letters, followed by a space and /, then
# anything ending in index.php, another space and then the characters HTTP/. This is probably intended to match
# something like "GET /index.php HTTP/1.1", but the .* would also make it match "GET /windex.php HTTP/1.1", I think
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
# if the above test passes, take any path ending in index.php and send a permanent redirect to
# a / plus whatever is before the index.php -- the $1 picks up the things in parens (.*)
# Again, I doubt this is what you want
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
# I think this is just wrong, but this could be something I don't know about. $1 is usually a reference to the first thing
# that is enclosed in parenthesis, so not sure why it's here, and the second part says "does not match something starting
# with "forum/adm/"
RewriteCond $1 !^forum/adm/
# Similar to the rewrite cond above, but this one doesn't limit the number of characters the request starts with, just saying
# 1 or more capital letters, a space, a slash, zero or more occurrences of anything except a / but ending with a /, and then
# a possible, but not required "index.php", then an actual "?", anything except a /, a space, and HTTP/. Phew!
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*(index\.php)?\?[^\ ]*\ HTTP/
# Yikes. Something similar to the above for a match on the path, should be redirected to the domain name plus everything that
# matches (([^/]+/)*).
RewriteRule ^(([^/]+/)*)(index\.php)?$ http://www.domain.info/$1? [R=301,L]
RewriteEngine on
#
# Externally redirect requests for "/" or "/index.php" plus query string in any directory
# to "/" in the originally-requested directory, removing the query string. All requests to
# the /forum/adm subdirectory are excluded from this rule, and will not be redirected.
RewriteCond $1 !^forum/adm/
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*(index\.php)?\?[^\ ]*\ HTTP/
RewriteRule ^(([^/]+/)*)(index\.php)?$ http://www.domain.info/$1? [R=301,L]
#
# Externally redirect all requests for "/index.php" without query string
# in any directory to "/" in the originally-requested directory.
# Note that /forum/adm subdirectory is NOT excluded from this rule.
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$ http://www.domain.info/$1 [R=301,L]
#
# Externally redirect requests for non-canonical domain.info and www.domain.info
# hostname variants to canonical hostname, to include non-www, appended FQDN
# indicator or port number, or uppercase characters in requested hostname.
RewriteCond %{HTTP_HOST} ^domain\.info [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.info(\.|\.?:[0-9]+)$ [NC,OR]
RewriteCond %{HTTP_HOST} [A-Z]
RewriteRule ^(.*)$ http://www.domain.info/$1 [R=301,L]
# Externally redirect requests for all non-blank non-canonical hostnames to the canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.domain\.info)?$
RewriteRule ^(.*)$ http://www.domain.info/$1 [R=301,L]