[ic] Pretty URLs / Duplicate Content

Cameron B. Prince cplists at princeinternet.com
Sat Dec 11 18:03:28 UTC 2010


Hey guys,

A week or so back I asked if there was a way to stop Interchange from
allowing page, page.htm and page.html to be used to access pages within a
catalog. No one responded with a complete solution so I took a stab at it
with Apache mod_rewrite. Here are my rewrite rules to solve this problem and
also remove the /cgi-bin/vlink portion of the URLs.

The code is set up to 301 redirect all the old URLs so there should be no
broken bookmarks and most of your page ranking should transfer. You will
need to set CGI_URL to "/" in the variable.txt file so that the area and
page tags create URLs without the vlink.

Finally, set Mall to No in interchange.cfg so that the session cookie
doesn't include the vlink. (This will be problematic for those running
multiple catalogs under the same domain name.)

Enjoy,
Cameron


RewriteEngine On

# THIS FORCES ALL REQUESTS INCLUDE THE WWW
# (EDIT THE DOMAIN NAME IN EACH LINE)
RewriteCond %{HTTP_HOST} ^domain.com(.*)$
RewriteRule ^(.*)$  http://www.domain.com$1 [R=301,L,QSA]

# THESE RULES ALLOW ACCESS TO STATIC CONTENT
# (EDIT AS NEEDED TO INCLUDE YOUR CONTENT)
RewriteRule ^/favicon.ico [PT,L]
RewriteRule ^/robots.txt [PT,L]
RewriteRule ^/javascript/.* - [PT,L]
RewriteRule ^/css/.* - [PT,L]
RewriteRule ^/images/.* - [PT,L]
RewriteRule ^/interchange-5/.* - [PT,L]

# THIS RULE FORCES ALL INDEX REQUESTS TO THE DOMAIN NAME ONLY
RewriteRule ^/index(.htm(l)?)?$ / [R=301,L,QSA]

# THIS RULE REDIRECTS .HTM TO .HTML
RewriteRule ^/(.*)\.htm$  $1.html [R=301,L,QSA]

# THESE RULES FORCE ALL REQUESTS NOT EXCLUDED AND WITHOUT AN
# EXTENSION TO BE REDIRECTED TO INCLUDE .HTML
RewriteCond %{SCRIPT_FILENAME} !^$
RewriteCond %{SCRIPT_FILENAME} !^/$
RewriteCond %{SCRIPT_FILENAME} !\.html$
RewriteCond %{SCRIPT_FILENAME} !^/process$
RewriteCond %{SCRIPT_FILENAME} !^/admin
RewriteCond %{SCRIPT_FILENAME} !^/cgi-bin
RewriteRule ^/(.*)  $1.html [R=301,L,QSA]

# THIS RULE REDIRECTS REQUESTS SO THE VLINK IS EXCLUDED
# (EDIT THE CATNAME)
RewriteRule ^/cgi-bin/catname(.*) $1 [R=301,L,QSA]

# THESE RULES SEND THE REQUESTS THROUGH TO THE VLINK
# (EDIT THE CATNAME IN EACH LINE)
RewriteRule ^/$ /cgi-bin/catname/index [PT,L,QSA]
RewriteRule ^/(.*) /cgi-bin/catname/$1 [PT,L,QSA]
  





More information about the interchange-users mailing list