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


 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 301 Redirect
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic   

ebp
New Member

97 Posts

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
6891 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
New Member

97 Posts

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

ebp
New Member

97 Posts

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 Expert

Australia
778 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
8202 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 Expert

United Kingdom
759 Posts

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 Expert

Australia
778 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
   Topic   
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2019 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000