Hello David. I am in the process of changing an existing site into a Price Tapestry site. The site currently is a datafeed site with many pages indexed. I would like to know is there a way to make all the requested pages from the old site point to the new price tapestry home page or similar search results?
All right David, this is an example of my old product link from the same domain that I replaced with a Pricetapestry Site. http://www.petsupplyonlinestore.com/productdetails.php?sku=453701408. The new format with sku in url would be http://petsupplyonlinestore.com/product/453701408.html. Anywhere in the code where I can take advantage of 404 pages.
Hi,
Sure - that should be easy to rewrite! Try adding this to your .htaccess, immediately after the RewriteBase line...
RewriteRule ^productdetails.php?sku=(.*) product/$1.html [L,R=301]
This will redirect to the new page with HTTP status code 301 (Moved Permanently), which will mean search engines should update their index to the new page
Cheers,
David.
I tried this rewrite rule and it currently is not working correctly? All config rewrite settings are set to true.
RewriteRule ^productdetails.php?sku=(.*) product/$1.html [L,R=301]
Hi,
What actually happens now when you visit one of the old URLs with this rule in place?
Cheers,
David.
It gives me a http// 404 file not found error by using the exact link posted above and the new link posted above. It says oops this link appears to be broken.
Hi,
I just checked on your site and it doesn't look like it's even trying to execute the rule. Could you perhaps email me your .htaccess and i'll take a look...
Cheers,
David.
Hello David,
Thanks for the help with the productdetails.php. I have to ask your assistance on 1 more question for another site that I'll change with a little different productdetails.php page. The productdetails page is www.website.com/productdetails.php?table=MerchantName&sku=264508. I need to get this .htaccess for redirecting pages 404/301 to new productdetails.php using sku again along with the Merchant Name.
Thank you,
Roy
Hi Roy,
Definitely - several users have done similar things. The ideal situation of course if you can easily extract keywords from the old URLs is to redirect to search.php with those keywords as the query. For example; if your old site had URLs like:
http://www.example.com/info.php?productName=Some+Product
Then you could rewrite as follows (on a Linux server, a different rewrite solution would be required on Windows hosting)
RewriteRule info.php?productName=(.*) search.php?q=$1
If you're not sure what to use, post a couple of examples of your current URLs and I'll work out the rules for you...
Cheers,
David.