-
I've deleted products. How do I redirect customers to new ones? or to search instead?
Hi guys,
This is my question:
I have deleted many old watches products, and add many new watches product. ( i really should not do this)
Now have problems, some customers still can access old product page by google search.
Example: when custome access :
http://www.jewelrywall.com/rolex-oys...rj-p-8638.html
the page will show: "Sorry, the product was not found. "
Now, i do not want the page show these words, i want the page redirect to search page, search keywords is :
rolex oyster perpetual datejust mens watch
----------------------------------------------------
then i edit the page (includes\templates\template_default\templates\tpl_product_info_noproduct.php), and add new codes:
PHP Code:
//no product url: http://www.jewelrywall.com/rolex-oyster-perpetual-datejust-mens-watch-116233bksbrj-p-8638.html
function getUrl(){
$url="http://".$_SERVER["HTTP_HOST"];
if(isset($_SERVER["REQUEST_URI"])){
$url.=$_SERVER["REQUEST_URI"];
}
else{
$url.=$_SERVER["PHP_SELF"];
if(!empty($_SERVER["QUERY_STRING"])){
$url.="?".$_SERVER["QUERY_STRING"];
}
}
$eUrl=getUrl();
//exit("url=".$eUrl);
preg_match('/www\.jewelrywall\.com\/(.+)\-p\-([0-9]+)\.html/', $eUrl, $matches);
//print_r($matches);
$pname=str_replace('-','+',$matches[1]);
$searchUrl='http://www.jewelrywall.com/index.php?main_page=advanced_search_result&search_in_description=1&keyword='.$pname;
//print $pname;
zen_redirect($searchUrl);
But it do not work, how should i do?
Or have another better way to fix this "the product was not found" problem?
Thanks for helps!!!!!!!
Miles
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Code:
redirect 301 /rolex-oyster-perpetual-datejust-mens-watch-116233bksbrj-p-8638.html http://www.jewelrywall.com/
In your htaccess.
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Thanks ~Melanie!
But there are many other deleted products(about 1000), how use 301 in htaccess to redirect ?
i think the zencart system should kow the product is not existed, then redirect to other url, that is better, but i do not know how and where to modify?
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
I'm here with a similar question. When a product gets deleted, the link to the deleted product generates the "no product" page. It's just a regular "product_info" page using the tpl_product_info_noproduct.php template.
Also—and this is important: the server responds with a 404 error! That should never happen for a product that's been deleted. The "no product" page shouldn't generate an error. Not sure why this happens.
So—how can we generate a more helpful response? The idea of returning search results is a very good one, but there's a lot of functionality missing (keyword lookup for one thing) that makes this not easily possible. How about just sending them to the category page? That should be possible, but by the time you're serving the template it's too late for a header redirect, which would be the most seamless and SEO-friendly way to do it.
I'm looking into a rewrite in the .htaccess that would send the visitor to the category page for the product.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
OK, here's the solution I'm using. Right up front I want to say this is not necessarily the best way to address this issue—partly because it alters a file that might be overwritten in an upgrade, and I would normally not do this because it leads to trouble down the road. (I tried using an override for this, but it didn't work)
So, if someone looks for a deleted product (because there's a link somewhere on the web that pointed to it) the user comes in with a URL like this: /index.php?main_page=product_info&cPath=4&products_id=61
I altered the file /includes/modules/pages/product_info/main_template_vars.php
On line 31 there's a check for a non-existent product. Normally it send the user to the "noproduct" page. For my change, I inserted a PHP header function like this:
Code:
$requeststring = (isset($_GET['cPath']))?'&cPath='. (int)$_GET['cPath']:'';
header('location:index.php?main_page=index'.$requeststring);
This sends them to the category the product was in. If the category is also non-existent, it goes to the "no products in this category" page, which is fine by me. If there's no category in the URL at all, it goes to the site index page.
Either way, no error is generated.
So this is what I did and so use this change at your own risk, test the hell out of it and use your own programming skills and common sense to do it better if you want.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Also—and this is important: the server responds with a 404 error! That should never happen for a product that's been deleted. The "no product" page shouldn't generate an error. Not sure why this happens.
Because the page/product is gone and that or a permanent redirect is the proper response.
Quote:
So—how can we generate a more helpful response? The idea of returning search results is a very good one, but there's a lot of functionality missing (keyword lookup for one thing) that makes this not easily possible. How about just sending them to the category page? That should be possible, but by the time you're serving the template it's too late for a header redirect, which would be the most seamless and SEO-friendly way to do it.
I'm looking into a rewrite in the .htaccess that would send the visitor to the category page for the product.
The page they are sent to is not an issue, sure you can add functionality here to assist the shoppers and I agree fully, but the correct response in this case is still a 404.
Quote:
OK, here's the solution I'm using. Right up front I want to say this is not necessarily the best way to address this issue—partly because it alters a file that might be overwritten in an upgrade, and I would normally not do this because it leads to trouble down the road. (I tried using an override for this, but it didn't work)
Upgrade overwrites are the least of your worry, by removing the error you have created a new canonical address, probably with a 302 which is a serious duplication issue... especially wide scale like you are talking about.
Again, the resulting page is a non issue... send them where you wish. The server's response MUST be a 404 or a 301 or you are causing a great deal more than you are solving with duplication and redirect issues for non canonical urls.
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
@mprough
Thanks for your informative response! I admit I'm somewhat ignorant of these issues with setting the proper error for a page that is not found. I guess I was thinking a "product not found" is not at all the same as a "page not found"
If I understand you correctly, I just need to add a 404 error response to my redirect.
thanks again
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
7thVeil, I have edited your code and have some other relevant information and technique regarding this issue here http://pro-webs.net/blog/2010/03/21/...tock-products/
I have always forced a permanent redirect by hand (ultimate control), but I certainly understand the need for a more large scale dynamic solution. So I edited your code to achieve this.
Cheers,
Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
mprough
7thVeil, I have edited your code and have some other relevant information and technique regarding this issue here
http://pro-webs.net/blog/2010/03/21/...tock-products/
I have always forced a permanent redirect by hand (ultimate control), but I certainly understand the need for a more large scale dynamic solution. So I edited your code to achieve this.
Cheers,
Melanie
Hi Melanie, the redirection example you gave:
redirect 301 /index.php?main_page=product_info&cPath=5&products_id=38 http://www.domain.com/
is not working on my site. I put it in the .htaccess file in the root but when I go to the product page it simply does not redirect. Do you have any idea why? I am not using any URL rewrite modules.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
It is because of your url rewrites. You can try putting the redirect after the Ultimate SEO rules, but likely it will leave you with an appended url for the resulting page.
This is one of the many reasons we no longer install urls rewrites.... The very small value does not outweigh the loss of functionality, options and load time lost.
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
If you ever use, or intend to use, rewrites in the future (or if any of your other rules found in the .htaccess file use RewriteRule already) change the method slightly.
Instead of using Redirect or RedirectMatch, use RewriteRule with the [R=301,L] flags. It is important that all of your redirect/rewrite code belongs to the same Apache module.
To be clear, RewriteRule comes from Mod_Rewrite and Redirect and RedirectMatch come from Mod_Alias.
Execution order of your directives is controlled NOT by the order the code is listed in your .htaccess file, but by the module execution order within .htaccess.
That is, if Mod_Alias runs before Mod_Rewrite, your Redirect and RedirectMatch directives would be executed before your RewriteRule directives (good!) BUT if Mod_Rewrite runs before Mod_Alias, your RewriteRule directives would be executed before your Redirect and RedirectMatch directives (bad!).
The effect of that would be to expose rewritten filepaths back out onto the web as new URLs, to create unwanted redirection chains, and generally not work as expected.
You don't have control over the module execution order. Your host has set that up. Most get it right, but a few do not.
You can protect yourself from the problem now and in the future by using RewriteRule for all of your directives.
You can also take advantage of the very powerful pattern matching controls that RewriteRule has to offer. Be aware that RewriteRule sees only the 'path' part of the URL. If you need to examine the requested hostname or parameters or the original HTTP request itself, add a preceding RewriteCond to examine the required attribute.
In general,
Code:
RewriteRule ^some-pattern http://www.example.com/somepath [R=301,L]
is the way to go.
If you use rewrites make sure that ALL of your external redirects are listed before the internal filepath rewrites. This is because the redirects send the user to a new URL, and the rewrites 'translate' a URL request into a different internal server filepath. Once the rewrites have executed and are looking on the server's hard drive for the content, it is way too late to be trying to alter the URL the user sees in the browser address bar.
Redirect first so that user sees the right URL. Once the user sees the correct URL, and only then, execute the rewrite to fetch the content.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
g1smd
If you ever use, or intend to use, rewrites in the future (or if any of your other rules found in the .htaccess file use RewriteRule already) change the method slightly.
Instead of using Redirect or RedirectMatch, use RewriteRule with the [R=301,L] flags. It is important that all of your redirect/rewrite code belongs to the same Apache module.
To be clear, RewriteRule comes from Mod_Rewrite and Redirect and RedirectMatch come from Mod_Alias.
Execution order of your directives is controlled NOT by the order the code is listed in your .htaccess file, but by the module execution order within .htaccess.
That is, if Mod_Alias runs before Mod_Rewrite, your Redirect and RedirectMatch directives would be executed before your RewriteRule directives (good!) BUT if Mod_Rewrite runs before Mod_Alias, your RewriteRule directives would be executed before your Redirect and RedirectMatch directives (bad!).
The effect of that would be to expose rewritten filepaths back out onto the web as new URLs, to create unwanted redirection chains, and generally not work as expected.
You don't have control over the module execution order. Your host has set that up. Most get it right, but a few do not.
You can protect yourself from the problem now and in the future by using RewriteRule for all of your directives.
You can also take advantage of the very powerful pattern matching controls that RewriteRule has to offer. Be aware that RewriteRule sees only the 'path' part of the URL. If you need to examine the requested hostname or parameters or the original HTTP request itself, add a preceding RewriteCond to examine the required attribute.
In general,
Code:
RewriteRule ^some-pattern http://www.example.com/somepath [R=301,L]
is the way to go.
If you use rewrites make sure that ALL of your redirects are listed before those. This is because the redirects send the user to a new URL, and rewrites 'translate' a URL request into a different internal server filepath. Once rewrites have executed and are looking on the server's hard drive for the content it is way too late to be trying to alter the URL the user sees in the browser address bar.
Redirect first so that user sees the right URL. Once the user sees the correct URL, and only then, execute the rewrite to fetch the content.
Unfortunately, even this method will produce a resulting url which is appended with a ? or ?string because of USEO. A good friend of mine in the UK and I worked very hard to accomplish this, and we did for a site which was changing platforms.... But trust me it was no easy task and surely not clean as we had to also strip the appended strings caused by USEO. It was many many lines of syntax as we could not grab a query string to batch any of them and sanitize them as well.
Best solution is to avoid SEO rewrites for your Zen Cart. Changing product titles changes and loses the indexed urls. Rewrites and redirects for anything are nearly impossible and the load speed is diminished somewhat as well.
If there were a cleaner solution, then sure rewrite them... But I have tested them all and the only one I think is close is Ceon. The rest all have some or all of the functionality issues above.
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
mprough
It is because of your url rewrites. You can try putting the redirect after the Ultimate SEO rules, but likely it will leave you with an appended url for the resulting page.
This is one of the many reasons we no longer install urls rewrites.... The very small value does not outweigh the loss of functionality, options and load time lost.
~Melanie
Im not using any of the URL rewrite modules and have never done. My .htaccess file looks like this:
----------------------
<Files 403.shtml>
order allow,deny
allow from all
</Files>
# redirects any URL that includes: record_company.php/password_forgotten.php this is a security patch
RedirectMatch Permanent ^/(.*[record_company.php]+)/(password_forgotten.php)$ /page_not_found.php
# redirects any URL that includes: /images/wp- with 'wp-' being anything that ends with '.php'
# this allows for images named such as 'wp-header.jpg' to work
RedirectMatch Permanent ^/(.*[images]+)/(wp-.*\.php)$ /page_not_found.php
redirect 301 /index.php?main_page=product_info&cPath=5&products_id=38 http://www.example.com/
ErrorDocument 404 /index.php?main_page=page_not_found
RewriteEngine On
# Index Redirect for /index.(html?|php) with no parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?|php)\ HTTP/
RewriteRule ^index\.(html?|php)$ http://www.example.com/? [R=301,L]
# Canonical Redirect non-www and/or appended port number to www [EXCLUDE /admin requests]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
----------------------------
The redirect 301 /index.php?main_page=product_info&cPath=5&products_id=38 http://www.example.com/
does not redirect to http://www.example.com/ when I go to /index.php?main_page=product_info&cPath=5&products_id=38
Do you see anything Im doing wrong?
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Yes, there are a lot of problems. My earlier post (above) covers most of those. In summary.
Change all of the "Redirect" and "RedirectMatch" rules to use RewriteRule with [R=301,L] flags, and list those before all of your other rules.
You'll need to look at QUERY_STRING using a RewriteCond too.
The .* construct in your code is VERY inefficient. If it is meant to match none, one, or multiple folder levels, use something like (([^/]+)/*) instead. It will run hundreds of times faster. The new pattern means (("not a slash" one or more times), followed by slash) the whole of that "zero or more times").
[record_company.php] matches any single letter from the list r e c o r d _ m p a n y h and the + says "one or more times", so a request for "drocer_ynapmoc.hph" or for "cordpan" would also fulfill the pattern. The brackets aren't needed at all. You need to match the literal "record_company.php" not a list of letters.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
... and make sure you add the [L] flag to the end of every rule.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
g1smd
Yes, there are a lot of problems. My earlier post (above) covers most of those. In summary.
Change all of the "Redirect" and "RedirectMatch" rules to use RewriteRule with [R=301,L] flags, and list those before all of your other rules.
You'll need to look at QUERY_STRING using a RewriteCond too.
The .* construct in your code is VERY inefficient. If it is meant to match none, one, or multiple folder levels, use something like (([^/]+)/*) instead. It will run hundreds of times faster. The new pattern means (("not a slash" one or more times), followed by slash) the whole of that "zero or more times").
[record_company.php] matches any single letter from the list r e c o r d _ m p a n y h and the + says "one or more times", so a request for "drocer_ynapmoc.hph" or for "cordpan" would also fulfill the pattern. The brackets aren't needed at all. You need to match the literal "record_company.php" not a list of letters.
Wow..thanks for the info, ... with my limited knowledge of .htaccess files I will need to re-read your comments a few times :D
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
This is Server Configuration Code, so YOU need to know exactly how it works so that YOU can maintain it as your site evolves. Use the Mod_Rewrite documentation at apache.org for guidance as well as the examples here.
One simple typo can bring your whole site down (if you are lucky) or slowly and silently erode your search listings until the fault puts you and your site out of business. So, be sure you know what every line of code does and why it is there.
Make sure that every block of code has # comments explaining exactly what it does. You'll thank yourself six months later.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Ok, to correct the RewriteRule I did the following:
RewriteEngine On
# Index Redirect for /index.(html?|php) with no parameters
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?|php)\ HTTP/
RewriteRule ^index\.(html?|php)$ http://www.example.com/? [R=301,L]
# Canonical Redirect non-www and/or appended port number to www [EXCLUDE /admin requests]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
#Redirects product page 187 to index
RewriteRule ^index.php?main_page=product_info&cPath=65&products_id=187 http://www.example.com/ [R=301,L]
But the redirect rule for product page 187 still isnt redirecting. What am I doing wrong?
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
RewriteRule cannot 'see' query string data. It only sees the 'path part' of a URL, following the initial slash, up until the question mark.
Use a preceding RewriteCond testing %{QUERY_STRING} to see the parameter data, in the same way others have looked at THE_REQUEST and HTTP_HOST and REQUEST_URI.
Clear those parameters with a trailing question mark on the end of the target URL to stop them being re-appended.
Make sure that the most 'specific' rule is listed FIRST, otherwise you risk creating an unwanted 'redirection chain' for non-www requests.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Hi,
I have question about rewrite my home page from http://mysite.com to http://www.mysite.com. How to write a code for 301 redirect. Please help. :(
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
having trouble 'seeing' what you are saying here. how would this be written so that the redirect would work correctly?
#Redirects product page 187 to index
RewriteRule ^index.php?main_page=product_info&cPath=65&products_id=187 http://www.example.com/ [R=301,L]
Quote:
Originally Posted by
g1smd
RewriteRule cannot 'see' query string data. It only sees the 'path part' of a URL, following the initial slash, up until the question mark.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Look at the code several posts back. It has very similar constructs to what you need to use here.
Use a RewriteCond before the RewriteRule, and check the value of QUERY_STRING using a suitable pattern.
The pattern matching in RewriteRule matches only the path part of a URL.
That is, the pattern in RewriteRule sees only the emboldened part of the request:
Code:
www.example.com/some/path/to-a-file?parameter=value
The preceding part can be checked by looking at HTTP_HOST using a RewriteCond.
The following part can be checked by looking at QUERY_STRING using a RewriteCond.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
So would someone be willing to look at my site and tell me the exact code I need? This is all above my head and my SEO guy says this is a major problem for me that needs fixing and why my PR is totally gone. I get a 302 before the 404 on deleted items. I'm willing to hire for services. Please let me know :) Thanks! Amy
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
I'll bet you're using:
Code:
ErrorDocument 404
http://www.example.com/index.php?main_page=page_not_found
This MUST be changed to:
Code:
ErrorDocument 404 /index.php?main_page=page_not_found
Look in the .htaccess file for this code.
The ErrorDocument directive must NOT contain a domain name.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
im so sorry but i have been studying this thread for some time now trying to redirect a dynamic page (/index.php?main_page=product_info&products_id=537) to my index page (well preferably to the replacement product if possible but index if this is too complicated) and i am very out of my depth
im not using any seo mods to change urls, the only things i am using are rewrites for non www to www and index to root, but i can't for the life of me get the 301 redirect to work and i am trying to follow what you are saying about rewrite instead of redirect but again im really struggling, i dont know much about htaccess at all and im desperately trying to learn. is there anyway you could give a working example of what you are speaking about above please? i only have about ten products to redirect but they have pretty good rankings so i would like to redirect some of that back inot my site if possible.
with regards to the non www to www code i have used, i struggled with getting it to work on my server and ended up having to contact them direct for the code as no others worked that i had come across so that is what im using, i dont know if this is the reason for the old product 301 to diff page isnt working?
my htaccess is below:
Code:
RewriteEngine On
#canonical redirect from non www to www
RewriteCond %{HTTP_HOST} !^(www\.livvylou\.co.uk)?$
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteRule (.*) http://www.livvylou.co.uk/$1 [R=301,L]
# Index Redirect to root
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?|php)\ HTTP/
RewriteRule ^index\.(html?|php)$ http://www.livvylou.co.uk/? [R=301,L]
ErrorDocument 404 /index.php?main_page=page_not_found
#redirect rss page to actual feed
redirect 301 /rss.php http://www.livvylou.co.uk/feed/general/feed.xml
#Redirect old products to index
RewriteRule ^/index.php?main_page=product_info&products_id=537 http://www.livvylou.co.uk/ [R=301,L]
any help at all would be very much appreciated.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
bonnit
im so sorry but i have been studying this thread for some time now trying to redirect a dynamic page (/index.php?main_page=product_info&products_id=537) to my index page (well preferably to the replacement product if possible but index if this is too complicated) and i am very out of my depth
im not using any seo mods to change urls, the only things i am using are rewrites for non www to www and index to root, but i can't for the life of me get the 301 redirect to work and i am trying to follow what you are saying about rewrite instead of redirect but again im really struggling, i dont know much about htaccess at all and im desperately trying to learn. is there anyway you could give a working example of what you are speaking about above please? i only have about ten products to redirect but they have pretty good rankings so i would like to redirect some of that back inot my site if possible.
with regards to the non www to www code i have used, i struggled with getting it to work on my server and ended up having to contact them direct for the code as no others worked that i had come across so that is what im using, i dont know if this is the reason for the old product 301 to diff page isnt working?
my htaccess is below:
Code:
RewriteEngine On
#canonical redirect from non www to www
RewriteCond %{HTTP_HOST} !^(www\.livvylou\.co.uk)?$
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteRule (.*) http://www.livvylou.co.uk/$1 [R=301,L]
# Index Redirect to root
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?|php)\ HTTP/
RewriteRule ^index\.(html?|php)$ http://www.livvylou.co.uk/? [R=301,L]
ErrorDocument 404 /index.php?main_page=page_not_found
#redirect rss page to actual feed
redirect 301 /rss.php http://www.livvylou.co.uk/feed/general/feed.xml
#Redirect old products to index
RewriteRule ^/index.php?main_page=product_info&products_id=537 http://www.livvylou.co.uk/ [R=301,L]
any help at all would be very much appreciated.
Try something like this
Quote:
RewriteCond %{QUERY_STRING} products_id=537
RewriteRule (.*) http://www.livvylou.co.uk/$1? [R=301,L]
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
AMAZING!!!!
it worked, thank you SO much!
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
bonnit
AMAZING!!!!
it worked, thank you SO much!
Very welcome
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
one more very quick question (sorry!!)
i also need to do this for some image folders which i uploaded as "/images/medium/products/gift cards/" rather than "/images/medium/products/gift_cards/" (had a space instead of underscore
would this be the same method or different?
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
That you must really fix... cannot redirect it
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
yes sorry, i have fixed the folder name on my server and products etc but i am still getting requests for those images and a 404 response, i meant in terms of redirecting them to the correct place rather than them searching for a broken url
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Hi
Can someone please tell me how to put mulitple product ids in Rewrite condition.
RewriteCond %{QUERY_STRING} products_id=537
RewriteRule (.*) http://www.livvylou.co.uk/$1? [R=301,L]
I am able to get this working for a single product id but dont know how to put multiple product ids in condition.
please help me in getting out of this.
thanks.
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
This part is the query string
products_id=537
So for example changing it to
products_id=
would redirect all product pages.
You must identify a common string that all of the pages you want to redirect share.
~Melanie
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Quote:
Originally Posted by
mprough
7thVeil, I have edited your code and have some other relevant information and technique regarding this issue here
http://pro-webs.net/blog/2010/03/21/...tock-products/
I have always forced a permanent redirect by hand (ultimate control), but I certainly understand the need for a more large scale dynamic solution. So I edited your code to achieve this.
Cheers,
Melanie
Melanie
I know this is an old post but I am having a similar issue with Sorry, the product was not found. on pages products have been roved I am using:
Zen Cart 1.3.9h
Patch: 1::
Database Patch Level: 1.3.9h
and the solution you gave didn't work in this version. Do you have any suggestions on how to fix this is the version in have mentioned?
Any help would be greatly appreciated.
This is what I am referring to:
How about a more dynamic solution?
In the forum thread we noted earlier, Zenner 7thVeil suggested using a php redirect to move these pages to the category page for their original location. This is an excellent technique for a dynamic solution. The code change supplied by 7thVeil, was very smart, but incomplete as it was returning a 302 in the header. We definitely do not want to return a 302, as this is a temporary redirect, but a permanent headache for your SEO campaign.
So I tweaked his alteration for the following which will send disabled and deleted products to their category page with a permanent 301 redirect. If no category exists they are sent to the product not found page.
In /includes/modules/pages/product_info/main_template_vars.php around line 31 find:
if ( $res->fields['total'] < 1 ) {
Just below this you will see
$tpl_page_body = '/tpl_product_info_noproduct.php';
Replace this line with
$requeststring = (isset($_GET['cPath']))?'&cPath='. (int)$_GET['cPath']:'';
header( "HTTP/1.1 301 Moved Permanently" );
header('location:index.php?main_page=index'.$requeststring);
Remember this is really a very dynamic solution and you are giving up the ultimate control over where this product page url should be sent. There is also the possibility, if you are using a SEO rewrite module, that this tweak will result in a double redirect. This is not a good situation, so if you apply this and the header for the pages is sending a double redirect, or worse, a loop... then this solution is not for you.
Gary
-
Re: I've deleted products. How do I redirect customers to new ones? or to search inst
Hello
did you find the way to make it work with 1.3.9h?
I tried, it redirects ok but creates a PHP fatal error for the line 188:
$zco_notifier->notify('NOTIFY_MAIN_TEMPLATE_VARS_EXTRA_PRODUCT_INFO');
PHP Warning: require(/my/site/domain.com/includes/templates/custom/templates) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /my/site/domain.com/includes/modules/pages/product_info/main_template_vars.php on line 188
[19-Feb-2012 19:50:27] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required 'includes/templates/custom/templates' (include_path='.:/usr/local/lib/php') in /my/site/domain.com/includes/modules/pages/product_info/main_template_vars.php on line 188
...