I've recently installed Price Tapestry on an old domain. I wish to redirect old .HTM pages to suitable dynamic replacements on the Price Tapestry site.
Here's my .htaccess file.
Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^review/(.*).html$ reviews.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^merchant/$ merchants.php
RewriteRule ^merchant/(.*)/$ search.php?q=merchant:$1:&rewrite=1%{QUERY_STRING} [L]
RewriteRule ^merchant/(.*)/(.*).html$ search.php?q=merchant:$1:&page=$2&rewrite=1%{QUERY_STRING} [L]
RewriteRule ^category/$ categories.php
RewriteRule ^category/(.*)/$ search.php?q=category:$1:&rewrite=1%{QUERY_STRING} [L]
RewriteRule ^category/(.*)/(.*).html$ search.php?q=category:$1:&page=$2&rewrite=1%{QUERY_STRING} [L]
RewriteRule ^brand/$ brands.php
RewriteRule ^brand/(.*)/$ search.php?q=brand:$1:&rewrite=1%{QUERY_STRING} [L]
RewriteRule ^brand/(.*)/(.*).html$ search.php?q=brand:$1:&page=$2&rewrite=1%{QUERY_STRING} [L]
# 404 error -> search page
ErrorDocument 404 /search.php?q=no+results
# Stop hotlinking of images
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?kiddstoys.co.uk/.*$ [NC]
RewriteRule \.(gif|jpg|js|css)$ - [F]
It works fine, until I start adding 301 redirects:
Redirect 301 /widgets.htm http://www.domain.co.uk/product/widgets.html
My Apache log says: "Redirect takes two or three arguments, an optional status, then document to be redirected and destination URL".
I'm guessing this is to do with redirecting to URLs which are created on the fly by the .htaccess file, but no idea how to fix it.
Any bright ideas? Thanks in advance.
Hi,
Have you tried putting the redirects at the top of .htaccess rather than at the end? Not sure it will make any difference - i'm just thinking through what i'd do in this situation...!
Cheers,
David.
Hi,
I just tried this on my test server and it worked fine - even after adding the other additional code that you are using over and above Price Tapestry's .htaccess.
I would create a test folder, and then create a single .htaccess in that folder containing a simple redirect to another URL, also in that test folder, for example:
.htaccess
Redirect 301 /test/test1.html http://www.domain.co.uk/test/test2.html
(don't forget to create a file called test/test2.html!)
If it works in the test folder, then we'll know to look at what else might be causing the error...
Cheers,
David.