Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
Author « Topic »  

ebp
Advanced Member

136 Posts

Pre-sales questions only
(More Details...)

Posted - 10/12/2015 :  15:27:37  
Hi, I'm on PHP version and I'm trying to figure out how to properly redirect old product that I no longer carry using .htaccess.

Here is old and new link.

www.example.com/proddetail.php?prod=SH-CRANK-KIT

www.example.com/proddetail.php?prod=SH-CRANK-NEW-KIT

When I did this, it did not work at all

Redirect http://www.example.com/proddetail.php?prod=SH-CRANK-KIT http://www.example.com/proddetail.php?prod=SH-CRANK-NEW-KIT

Thank you for help

Dom

Phil
ECT Moderator

United Kingdom
7680 Posts

Posted - 10/12/2015 :  16:08:41  
Hi Dom,
Take a look here this should help you - http://stackoverflow.com/questions/1513164/htaccess-301-redirect-dynamic-url



* Database Migrations and Conversions*
* ASP to PHP Cart Conversions*

*Contact Us*
*Buy The PHP Capture Card Plugin*
*Rate Our Services/View Our Feedback*

Edited by - Phil on 10/12/2015 16:09:29

ebp
Advanced Member

136 Posts

Pre-sales questions only
(More Details...)

Posted - 10/17/2015 :  10:01:57  
Thank you!

ebp
Advanced Member

136 Posts

Pre-sales questions only
(More Details...)

Posted - 11/22/2015 :  10:23:19  
I have been looking at the post but still can't get it to work with just few specific, old products. I'm not trying to generate a rule for all but only redirect few old specific products that got some nice SEO juice to new ones.

Is that possible?

Andy
ECT Moderator

95440 Posts

Posted - 11/23/2015 :  02:50:07  
Hi

Can you let us know what you have tried and we'll see what's up?

Andy

Please feel free to review / rate our software

ITZAP
Ecommerce Template Guru

Australia
1017 Posts

Posted - 01/17/2017 :  18:46:06  
Yes ! So many times this Forum comes up with the exact solution you need
How to redirect
www. example .com/proddetail.php?prod=SH-CRANK-KIT
to
www. example .com/proddetail.php?prod=SH-CRANK-NEW-KIT

Here are the ".htaccess" file entries that achieve the proddetail.php page redirect, as described in that example.
# ======================================================
# URL Redirects for proddetail.php pages
# ======================================================
RewriteCond %{QUERY_STRING} ^prod=SH-CRANK-KIT
RewriteRule ^proddetail\.php$ http:// www. example .com/proddetail.php?prod=SH-CRANK-NEW-KIT [R=301,L]

Just delete the spaces I put in the www. example .com URL above.
Please, can this topic be transferred into the "Advanced Tips and Tricks" forum so it is not lost ?

Gary

dbdave
ECT Moderator

USA
10408 Posts

Posted - 01/17/2017 :  19:49:02  
Good one Gary - and for anyone wanting to do this on a windows server here it is
web.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="some-uniquename Redirect" stopProcessing="true">
<match url="^proddetail.asp?$" />
<conditions>
<add input="{QUERY_STRING}" pattern="^prod=OLD-PRODUCT-ID$" />
</conditions>
<action type="Redirect" url="proddetail.asp?prod=NEW-PRODUCT-ID" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

David
ECT Power User

Edited by - dbdave on 01/17/2017 19:49:51

Steved
Ecommerce Template Guru

United Kingdom
1022 Posts

Pre-sales questions only
(More Details...)

Posted - 01/18/2017 :  16:07:18  
With this mind, does anyone have an answer to my rewrite question earlier this week about rewriting the seo friendly urls if you need to retain link juice for products that are removed?

https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=106768

Any assistance greatly appreciated.

Steve

ITZAP
Ecommerce Template Guru

Australia
1017 Posts

Posted - 11/02/2017 :  19:45:49  
.htaccess URL Redirect for obsolete /has-static-url.php page to new proddetail.php page
======================================================

redirect 301 /ssl-security-certificate.php https:// www. example .com/proddetail.php?prod=free-ssl-security-certificate

Gary

Edited by - ITZAP on 11/29/2017 14:19:06

pauld
Advanced Member

USA
486 Posts

Posted - 06/17/2021 :  09:46:29  
Hi, would the admins consider moving this '301 Redirect' article to the Tips and Tricks Hall of Fame section of the forum?

Google continues to show obsolete products as top search results for years after some of our items are no longer sold.

As a result, visitors would often encounter "out of stock" product pages and "page not found" errors on our site.

The best solution we've found is Gary's .htaccess fix shown below, one two-line entry for each obsolete product—


# ======================================================
# URL Redirects for Obsolete Product Detail Pages
# ======================================================
#
RewriteCond %{QUERY_STRING} ^prod=SH-CRANK-KIT
RewriteRule ^proddetail\.php$ http:// www. example .com/proddetail.php?prod=SH-CRANK-NEW-KIT [R=301,L]
#


Tip: the smallest typo in an .htaccess file can crash your website. You can check your .htaccess edits before uploading using one of the free online tools such as http://www.htaccesscheck.com/.


Edited by - pauld on 06/17/2021 09:52:27
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.05 seconds. Snitz Forums 2000