Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 27
  1. #11
    Join Date
    Oct 2007
    Posts
    161
    Plugin Contributions
    0

    Default Re: How to redirect a product page

    Thanks a lot for the responses, unfortunately I still couldnt get this working using and of the methods. Seems like it quite complicated to redirect a dynamic page.

  2. #12
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,128
    Plugin Contributions
    0

    Default Re: How to redirect a product page

    Quote Originally Posted by DML73 View Post
    Ok, Im trying to redirect:

    http://www.usconverters.com/index.ph...roducts_id=221

    to:

    http://www.usconverters.com/
    (I will make a custom landing page later)

    I added the following line in .htaccess in the root:

    redirect 301 /index.php?main_page=product_info&cPath=75&products_id=221 http://www.usconverters.com

    .htaccess is set to CHMOD 664

    but as far as I can see then its not redirecting, any ideas?
    http://www.usconverters.com/ << this is not a URL to a page

    http://www.usconverters.com/index.php << this is a URL to a page

    Which is why I mentioned earlier about first creating the page to be redirected to. Otherwise, we know life will get in the way and it could weeks or months before that page is created. In the meantime, you will have a lot of confused people and possibly missed Sales.

    And using any type of SEO module for "pretty URLs" could cause problems with the redirect.
    The learning is in the doing.

    Potent Products

  3. #13
    Join Date
    Oct 2007
    Posts
    161
    Plugin Contributions
    0

    Default Re: How to redirect a product page?

    Did anybody find out how to 301 redirect a single product page?

    I tried all the suggestions in this thread but nothing works. I have no URL mods or anyhting like that installed.

  4. #14
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: How to redirect a product page?

    Top of your .htaccess file should contain:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /store/

    Note: Replace /store/ with the relative web path of your catalog. If store is in the root then just use: /

    example: RewriteBase /

    Then add:

    #Old store URLs
    RewriteRule ^OLD-PRODUCT\.html$ "http\:\/\/www\.YOURDOMAIN\.com\/NEW-PRODUCT\.html" [R=301,L]
    RewriteRule ^OLD-PRODUCT2\.html$ "http\:\/\/www\.YOURDOMAIN\.com\/NEW-PRODUCT2\.html" [R=301,L]

    So your .htaccess will contain:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /store/

    #Old store URLs
    RewriteRule ^OLD-PRODUCT\.html$ "http\:\/\/www\.YOURDOMAIN\.com\/NEW-PRODUCT\.html" [R=301,L]
    RewriteRule ^OLD-PRODUCT2\.html$ "http\:\/\/www\.YOURDOMAIN\.com\/NEW-PRODUCT2\.html" [R=301,L]

  5. #15
    Join Date
    Mar 2010
    Location
    UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How to redirect a product page?

    Please disregard the post immediately above.



    You'll need this in the root .htaccess file:
    Code:
    RewriteEngine On
    
    RewriteCond %{QUERY_STRING} ^main_page=product_info&cPath=([0-9]+)&products_id=221$ [NC]
    RewriteRule ^zencart/(index\.php)?$ http://www.example.com/? [R=301,L]
    This redirects product ID 221 for all categories, for both www and non-www requests, and whether or not "index.php" is within the request.

    Change "zencart/" to your real folder name. Remove the "zencart/" part if the site is in the root folder. Note the trailing slash is also deleted.

    Final point. Never mix RewriteRule directives with Redirect or RedirectMatch directives within the same site. If you do, you can never be quite sure of the processing order. By mixing them up, you're using directives from two different Apache modules. Stick to just using RewriteRule for all directives.
    Last edited by Ajeh; 3 May 2010 at 04:17 PM. Reason: fix missing ?

  6. #16
    Join Date
    Mar 2010
    Location
    UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How to redirect a product page

    Quote Originally Posted by Website Rob View Post
    http://www.usconverters.com/ << this is not a URL to a page.

    http://www.usconverters.com/index.php << this is a URL to a page.
    Those two URLs are Duplicate Content for your site root. Only one of those should return 200 OK HTTP status.

    The canonical URL is the one without the default index filename included.

    The other should redirect to the canonical URL:
    Code:
    # Index Redirect for /index.php request with no parameters
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://www.example.com/? [R=301,L]
    
    # Index Redirect for /(index.php)?main_page=index(&cPath=<blank>) request
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?main_page=index(&cPath=)?\ HTTP/
    RewriteRule ^(index\.php)?$ http://www.example.com/? [R=301,L]
    
    # Redirect non-www and/or trailing port number etc, to www
    RewriteCond %{HTTP_HOST}  !^(www\.example\.com)?$
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
    
    # ErrorDocument
    ErrorDocument 404 /index.php?main_page=page_not_found
    If the store is located in a folder, add "/foldername" to both of the RewriteConds directly before the /index and before the /(index\.php) parts, and to the RewriteRule between the ^ and index\.php and between the ^ and (index\.php) parts, but add these in only the first two rulesets.

  7. #17
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: How to redirect a product page?

    Quote Originally Posted by g1smd View Post
    Please disregard the post immediately above.
    My, My...

    Has always worked for me - but perhaps I have other things going on in my .htaccess that requires me to do it the way I do...

  8. #18
    Join Date
    Mar 2010
    Location
    UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How to redirect a product page?

    There's several problems with your code.

    Firstly, it takes no account of query strings so cannot be used to solve this ZenCart question; and secondly, the literal target URL should not have any escaping within. Escaping is needed on literal periods, etc, only within the RegEx pattern (the bit "on the left"). Your code is also redirecting from folder to root, as the target URL does not contain a folder.
    Last edited by g1smd; 3 May 2010 at 07:15 AM.

  9. #19
    Join Date
    Nov 2006
    Location
    Brighton, CO
    Posts
    90
    Plugin Contributions
    0

    Default Re: How to redirect a product page?

    Quote Originally Posted by g1smd View Post
    There's several problems with your code.

    Firstly, it takes no account of query strings so cannot be used to solve this ZenCart question; and secondly, the literal target URL should not have any escaping within. Escaping is needed on literal periods, etc, only within the RegEx pattern (the bit "on the left"). Your code is also redirecting from folder to root, as the target URL does not contain a folder.
    Ah, I THINK I see what you're saying -

    We're using this code to redirect existing links that were once on an osCommerce shop to the new Zen Cart shop...

  10. #20
    Join Date
    Mar 2010
    Location
    UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How to redirect obsolete links to a different page?

    For redirecting from /folder/ to root, you might find this code is a bit cleaner: http://www.zen-cart.com/forum/showth...=150620&page=2

    Adjust the first chunk to suit your osCommerce URLs and place it in that folder. Ensure the second chunk, in the root, includes an exclusion for both the admin folder and for the folder where the osCommerce site used to reside (that's the !^/(admin|zencart) part of the code).

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. How to redirect a pseudo-static page using a 301 redirect ?
    By anahong in forum General Questions
    Replies: 1
    Last Post: 23 Jul 2010, 02:37 PM
  2. Redirect define page links
    By djdavedawson in forum General Questions
    Replies: 5
    Last Post: 18 Oct 2008, 08:44 PM
  3. Replies: 1
    Last Post: 10 Sep 2007, 10:10 PM
  4. Different Color for Links Depending on Page Location
    By jwashburn in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 10 Oct 2006, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •