I have been saving my old templates to preserve the static links for my site. Ie (mydomain.com/index.php/oldtempl/article will still load the article against the old template)
I have recently discovered this is a bad thing to do. It creates a lot of duplicate content (the entire site) in search engines and such. So I went into my horribly confusing .htaccess to attempt to automatically redirect anything with templates X and Y to template Z thus redirecting any old templates into the new template automatically and allowing me to dump the old template files from EE and clean things up a bit.
Problem is I am not very learned on regular expressions and haven’t been able to get it to work.
Can someone help me out? I am including the requisite potion of my .htaccess.
*Also on a side note I used LG.htaccess to generate an htaccess file to remove .index.php. Now system auto redirecting URLs (ie “view rendered template”) no longer work. They just stop processing and dump the URL into the address bar (ie http://www.ffpblog.com/?URL=http://www.ffpblog.com/system/404/) Any way to fix that?
Thanks a lot.
AddHandler application/x-httpd-php5 .php
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} ^old.ffpblog.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.old.ffpblog.com$
RewriteRule ^(.*)$ "http\:\/\/www\.ffpblog\.com\/index\.php\/old" [R=301,L]
*****EE SPAM BLOCK STUFF ****
# -- LG .htaccess Generator Start --
# .htaccess generated by LG .htaccess Generator v1.0.0
# <a href="http://leevigraham.com/cms-customisation/expressionengine/addon/lg-htaccess-generator/">http://leevigraham.com/cms-customisation/expressionengine/addon/lg-htaccess-generator/</a>
# secure .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Dont list files in index pages
IndexIgnore *
# EE 404 page for missing pages
ErrorDocument 400 <a href="http://www.ffpblog.com/index.php?/system/400">http://www.ffpblog.com/index.php?/system/400</a>
ErrorDocument 401 <a href="http://www.ffpblog.com/index.php?/system/401">http://www.ffpblog.com/index.php?/system/401</a>
ErrorDocument 403 <a href="http://www.ffpblog.com/index.php?/system/403">http://www.ffpblog.com/index.php?/system/403</a>
ErrorDocument 404 <a href="http://www.ffpblog.com/index.php?/system/404">http://www.ffpblog.com/index.php?/system/404</a>
# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp)$">
ErrorDocument 404 "File Not Found"
</FilesMatch>
RewriteEngine On
RewriteBase /
# remove the www
RewriteCond %{HTTP_HOST} ^(www\.$) [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
# Remove index.php
# Uses the "include method"
# <a href="http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method">http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method</a>
#Fixes CSS //////////
RewriteCond %{QUERY_STRING} ^(css=.*)$ [NC]
RewriteRule ^(.*)$ /index.php?/%1 [L]
# remainder of removing inxex.php //////////
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(system|search|ffp|s|scrapbook|desert|ffp_public|mobile|Export|old||members|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
Header set imagetoolbar "no"
</FilesMatch>
# -- LG .htaccess Generator End --