Forum Moderators: phranque
http://example.com/foo OK
http://example.com/foo/ 404 # Remove and 301 redirect trailing slashes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^\.example\.com$ [NC]
RewriteRule ^(.+)/$ http://example.com/$1 [R=301,L] # Make your site Class B. http://no-www.org/
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] http://vbdock.com/user-titles-update-3/ currently redirects to http://vbdock.com/user-titles-update-3, now avoiding any 404 errors # Remove and 301 redirect trailing slashes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^\.vbdock\.com$ [NC]
RewriteRule ^(.+)/$ http://vbdock.com/$1 [R=301,L] http://www.vbdock.com/user-titles-update-3/ and http://www.vbdock.com/user-titles-update-3 however aren't redirecting to http://vbdock.com/user-titles-update-3, which is the way I would like to see it (avoiding any duplicate content)
RewriteEngine On
# Make your site Class B. http://no-www.org/
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
# Remove and 301 redirect trailing slashes
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.+)/$ http://example.com/$1 [R=301,L] RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# Make your site Class B. http://no-www.org/
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
# Remove and 301 redirect trailing slashes
RewriteRule ^(.+)/$ http://example.com/$1 [R=301,L]
RewriteEngine on
#
# Externally redirect to remove trailing slashes if not a known
# subdirectory index and requested subdirectory does not exist
RewriteCond $1 !^(images|cssfiles|awstats|uploads)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://example.com/$1 [R=301,L]
#
# *** NOTE*** Use this rule if possible, otherwise delete it, then un-comment and use the next one...
# Externally redirect all non-blank non-canonical hostname requests to the canonical hostname
RewriteCond %{HTTP_HOST} !^(example\.com)?$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
#
# Externally redirect requests for most non-canonical "example.com"
# hostname variants to the canonical hostname
# RewriteCond %{HTTP_HOST} ^www\.example\.com [NC,OR]
# RewriteCond %{HTTP_HOST} ^example\.com(\.|\.?(:[0-9]+))$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]