You are here:  » 301 Page Redirects


301 Page Redirects

Submitted by ChrisNBC on Tue, 2013-04-09 10:08 in

Hi David,

I'm making the final few changes to my PT site before making it live but I have run into a bit of a problem!...I have created (from my existing html review pages) new php pages (which include the price and vendor code which you kindly created for me). I have moved these new php pages to the PT folder and have relinked all the internal site links to them. To avoid losing Google ranking I created a .htaccess file with a 301 redirect from the old html pages to the new php versions in the PT folder.

The file contains the lines:

RewriteEngine On
Redirect 301 /Product-Name.html http://www.example.com/Sites/Example/pt/ProductName.php

For some reason, the above has no impact whatsoever and I wondered if you could suggest where I'm going wrong?

Thanks in advance.
Regards
Chris

Submitted by support on Tue, 2013-04-09 18:07

Hi Chris,

Normally, a /pt/ folder would be a "private" install of Price Tapestry used by the WordPress or Joomla plugins but if you do want to redirect search engine traffic there, I would use a normal RewriteRule in this instance. Have a go with:

RewriteEngine On
Rewrite Base /
RewriteRule ^(.*).html$ //www.example.co.uk/Sites/Example/pt/$1.php [L]

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Tue, 2013-04-09 21:47

Hi David,

Thanks for your reply. Unfortunately, I don't think what you have suggested will work for the scenario I have. If I understand the 'rewrite' correctly it will divert every html page to a php equivalent in the PT folder. I have only duplicated the review (the ones containing the price/vendor code) pages of my site to the PT folder so what I really need to do is forward specific html pages to specific php pages in the PT folder. Could you suggest a way I could achieve this?

Thanks in advance.

Regards
Chris

Submitted by ChrisNBC on Tue, 2013-04-09 22:59

Hi David,

Just to let you know I have now got this working! Since I needed a one to one redirect I slightly modified your rewrite above to:

RewriteEngine On
RewriteRule ^Example\.html$ http://www.example.co.uk/Sites/Example/pt/Example.php [R=301,L]

Thanks again for all your help with this.

Regards
Chris

Submitted by Rocket32 on Mon, 2020-08-03 09:56

Hello David,

I tried the rewrite rule for product pages that changed from an updated merchant feed. Now some products works & others don't. Some new links have dash in some spaces in new link while some old links don't. The product is available but link is different due to feed change. Some links are indexed in search engines already. I can not get the above to work mainly for some links.

I added the following to the end of .htaccess for 1 of the links to test with no sucess.

RewriteRule ^product/Example2-5-ml\.html$ https://www.example.com/product/Example-2-5-ml.html [R=301,L]

Submitted by support on Mon, 2020-08-03 10:28

Hi,

That rule looks fine so what actually happens when you go to the old URL e.g.

https://www.example.com/product/Example2-5-ml.html

Do you get an Internal Server Error for example, or does it redirect but to something other than

https://www.example.com/product/Example-2-5-ml.html

However one thing that can get in the way of working on redirects is that browsers often cache location headers so if a previous rule was incorrect but subsequently corrected the browser may still be using the cached redirect. These are normally cleared by clearing all browser data (cookies, local storage etc.) for the site - that might be all it is...

Cheers,
David.
--
PriceTapestry.com

Submitted by Rocket32 on Mon, 2020-08-03 17:20

Hey I tried clearing cookies & cache. The same thing occurs as before. It does not go to error page. It stays on old link with & page says product no longer exists. But when I add the dash in the link, it appears like the product & info dynamically appears on page instantly.

Submitted by support on Tue, 2020-08-04 07:28

Hi,

As it sounds like the redirect is simply not happening, it may be just that it is out of place in .htaccess as it would need to go above the existing RewriteRule for /product/ otherwise the normal rule would take priority...

Cheers,
David.
--
PriceTapestry.com

Submitted by Rocket32 on Wed, 2020-08-05 05:03

Thanks David. It works perfect now after adding code just above original ^product redirect.