Forum Moderators: phranque
RewriteEngine on
#
# Externally redirect subdomain/domain.com/<something>.htm to subdomain/domain.com/<something>.html
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com
RewriteRule ^(.+)\.htm$ http://subdomain.domain.com/$1.html [R=301,L]
#
# Externally redirect domain.com/subdir/xyz or <anysubdomain>domain.com/subdir/xyz
# to subdomain.domain.com/xyz
RewriteRule ^subdir(/.*)?$ http://subdomain.domain.com$1 [R=301,L]
#
# Externally redirect all non-canonical subdomain hostname requests
# to canonical "subdomain.domain.com" hostname
RewriteCond %{HTTP_HOST} ^([^.]+\.)*subdomain\.([^.]+\.)*domain\.com
RewriteCond %{HTTP_HOST} !^subdomain\.domain\.com$
RewriteRule ^(.*)$ http://subdomain.domain.com/$1 [R=301,L]
#
# Externally redirect all non-canonical hostname requests to canonical "www.domain.com" hostname
RewriteCond %{HTTP_HOST} !^(www|subdomain)\.domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
subdomain.domain.com, in lieu of subdomain/domain.com -- a typo, using slash instead of the correct dot... subdomain.domain.com/*.htm --> subdomain.domain.com/*.html ^([^.]+\.)*" is driving me nuts. Would this be it: A phrase starting with One or More of AnyOneCharacter, followed by a Dot, all of that 1 or more times? Why go to that complex set in the two places you've used it; obviously I am missing something. subdomain.domain.com/file.htm and domain.com/subdir/file.htm
subdom.domain.com/file.html domain.com/file.html ^([^.]+\.)*
AddHandler server-parsed .html
AddHandler server-parsed .shtml
AddHandler server-parsed .htm
RewriteEngine On
# Externally redirect domain.com/subdir/xyz or <anysubdomain>domain.com/subdir/xyz
# to subdomain.domain.com/xyz
#RewriteCond %{HTTP_HOST} !^(.*)\.complianceofficer\.com$ [NC]
#RewriteCond %{HTTP_HOST} ^www\.complianceofficer\.com [NC]
#RewriteRule ^lighterside(/.*)?$ http://lighterside.complianceofficer.com/$1 [R=301,L]
#RewriteRule ^lighterside/index.html$ http://lighterside.complianceofficer.com/index.html [R=301,L]
RewriteRule ^lighterside(/.*)?$ http://lighterside.complianceofficer.com$1 [R=301,L]
# Externally redirect all non-canonical hostname requests to canonical "www.domain.com" hostname
RewriteCond %{HTTP_HOST} !^(www|lighterside)\.complianceofficer\.com$
RewriteRule ^(.*)$ http://www.complianceofficer.com/$1 [R=301,L]
Regarding duplicate SE scans and etc.....if all files are in the root directory, and all subdomains point there, then these pointers to the same file result into two different SE items, no?
what does this mean...and why did you use it?
RewriteRule ^subdir(/.*)?$ http://subdomain.domain.com$1 [R=301,L] RewriteRule ^lighterside(/.*)?$ http://lighterside.complianceofficer.com$1 [R=301,L] http://www.complianceofficer.com/lighterside/index.html http://lighterside.complianceofficer.com/index.html subdomain.domain.com points to this directory: domain.com/subdir subdom.domain.com/form.htm domain.com/subdir/file.htm, and RewriteRule ^lighterside(/.*)?$ http://lighterside.complianceofficer.com$1 [R=301,L] RewriteRule ^foo\.html$ http://www.google.com/ [R=301,L] index.htm to whereever, using this as the match term: index\.htm$ /lighterside/index.htm anywhere. RewriteRule [matchRule] http://lighterside.complianceofficer.com/index.html [R=301,L]