Thread: Redirect issue

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    1,670
    Plugin Contributions
    1

    Default Redirect issue

    v1.5.7b

    I have a need to redirect a page, old_domain/index.php?main_page=contact_us to new_domain/index.php?main_page=contact_us , however when doing so using cPanel it redirects (via .htaccess) to new_domain/index.php. This happens regardless of what the page may be that includes index.php? in the url ... e.g.
    index.php?main_page=products_new or /index.php?main_page=gv_faq.

    Is there another method I use to can redirect these pages without using cPanel and/or .htaccess?

    cheers, Mike

  2. #2
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,051
    Plugin Contributions
    61

    Default Re: Redirect issue

    In the old site's htaccess try something like this

    RewriteEngine On
    RewriteCond %{HTTP_HOST} (w*)old_domain\.com$ [NC]
    RewriteRule ^ http://new_domain.com%{REQUEST_URI} [L,R=301]

    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,798
    Plugin Contributions
    124

    Default Re: Redirect issue

    This will redirect the whole site, which may not be what the OP wants - if you ONLY want this one page to be redirected, how about just putting a redirect inside

    includes/modules/pages/contact_us/header_php.php

    on old_site?
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,051
    Plugin Contributions
    61

    Default Re: Redirect issue

    In that case a query string redirect in the htaccess on the old domain

    RewriteEngine On
    RewriteCond %{QUERY_STRING} contact_us
    RewriteRule (.*) https://new_domain.com/index.php?main_page=contact_us [R=301,L,NE]
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  5. #5
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    1,670
    Plugin Contributions
    1

    Default Re: Redirect issue

    Quote Originally Posted by swguy View Post
    This will redirect the whole site, which may not be what the OP wants - if you ONLY want this one page to be redirected, how about just putting a redirect inside

    includes/modules/pages/contact_us/header_php.php

    on old_site?
    many thanks for your response Scott - I think this approach is best - there is a definite issue with redirects in cPanel in that it totally ignores any code after /index.php (as per the examples above) nad hence any attempt to redirect a page will redirect the whole site - my host said that it may be to do with security albeit no changes to permissions / modsec would fix it?

    cheers, Mike

  6. #6
    Join Date
    Jan 2011
    Location
    Adelaide, Australia
    Posts
    1,670
    Plugin Contributions
    1

    Default Re: Redirect issue

    Quote Originally Posted by mprough View Post
    In that case a query string redirect in the htaccess on the old domain

    RewriteEngine On
    RewriteCond %{QUERY_STRING} contact_us
    RewriteRule (.*) https://new_domain.com/index.php?main_page=contact_us [R=301,L,NE]
    Hi Melanie, many thanks for your response - please refer to my reply to 'swguy' regarding the inherent issue with cPanel. Where only an individual page needs to be redirected I think a php redirect in the appropriate header will be the better approach. I once had a quantity of redirects from one site to another in place in cPanel and then added a redirect to a page with /index.php?main_page=contact_us [example] and it automatically obviated all the other redirects because it redirect the whole site which wasn't what I wanted.

    thanks again
    cheers, Mike

  7. #7
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,051
    Plugin Contributions
    61

    Default Re: Redirect issue

    Quote Originally Posted by shags38 View Post
    Hi Melanie, many thanks for your response - please refer to my reply to 'swguy' regarding the inherent issue with cPanel. Where only an individual page needs to be redirected I think a php redirect in the appropriate header will be the better approach. I once had a quantity of redirects from one site to another in place in cPanel and then added a redirect to a page with /index.php?main_page=contact_us [example] and it automatically obviated all the other redirects because it redirect the whole site which wasn't what I wanted.

    thanks again
    cheers, Mike
    Hi Mike,

    The redirect I provided should correctly land. It's not cPanel, it's the syntax that matters. The cPanel tool is really not a great way to edit your htaccess, it can make issues in the syntax.

    Code:
    RewriteEngine On
    RewriteCond %{QUERY_STRING} contact_us
    RewriteRule (.*) https://new_domain.com/index.php?main_page=contact_us [R=301,L,NE]
    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  8. #8
    Join Date
    Feb 2014
    Location
    Germany
    Posts
    130
    Plugin Contributions
    0

    Default Re: Redirect issue

    I don't want to hijack this thread but it seems the place to ask my question.
    Because of adding a new language I created new ezPages (I think I had to do so) which got a new ID.
    I have some good running ezPages posts and visitors just get an error (of course).
    I spent some hours about that now so I decided to use the board search and found this thread.
    What do you think could be the proper way to make zen cart redirects via htaccess?
    Simple Redirect 301 obviously don't work.

    Here's the old url: https://www.roller-aus-blech.de/inde...age=page&id=85
    Here's the new url: https://www.roller-aus-blech.de/inde...ge=page&id=100

    I meanwhile am going to take the following code for testing:

    RewriteCond %{QUERY_STRING} contact_us
    RewriteRule (.*) https://new_domain.com/index.php?main_page=contact_us [R=301,L,NE]
    My Zen-Cart Vespa Shop.
    GDPR compliant Webhosting in Germany.

  9. #9
    Join Date
    Nov 2007
    Location
    Woodbine, Georgia, United States
    Posts
    4,051
    Plugin Contributions
    61

    Default Re: Redirect issue

    Quote Originally Posted by Shop Suey View Post
    I don't want to hijack this thread but it seems the place to ask my question.
    Because of adding a new language I created new ezPages (I think I had to do so) which got a new ID.
    I have some good running ezPages posts and visitors just get an error (of course).
    I spent some hours about that now so I decided to use the board search and found this thread.
    What do you think could be the proper way to make zen cart redirects via htaccess?
    Simple Redirect 301 obviously don't work.

    Here's the old url: https://www.roller-aus-blech.de/inde...age=page&id=85
    Here's the new url: https://www.roller-aus-blech.de/inde...ge=page&id=100

    I meanwhile am going to take the following code for testing:

    RewriteCond %{QUERY_STRING} contact_us
    RewriteRule (.*) https://new_domain.com/index.php?main_page=contact_us [R=301,L,NE]
    That is a tough one because the number is the only unique part of the link... and the number 85 is likely used elsewhere in other links.

    maybe

    Code:
    RewriteEngine On
    RewriteCond %{QUERY_STRING} page&id=85
    RewriteRule (.*) https://www.roller-aus-blech.de/index.php?main_page=page&id=100 [R=301,L,NE]
    ~Melanie
    PRO-Webs, Inc. :: Recent Zen Cart Projects :: Zen Cart SEO – 12 Steps to Success
    **I answer questions in the forum, private messages are NOT answered. You are welcome to contact us via our website for professional engagements.

  10. #10
    Join Date
    Feb 2014
    Location
    Germany
    Posts
    130
    Plugin Contributions
    0

    Default Re: Redirect issue

    100%
    My Zen-Cart Vespa Shop.
    GDPR compliant Webhosting in Germany.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. SSL redirect issue
    By pixelpadre in forum General Questions
    Replies: 15
    Last Post: 28 Oct 2017, 02:23 PM
  2. Zenid Redirect Issue
    By bumba000 in forum General Questions
    Replies: 7
    Last Post: 23 Jan 2015, 11:52 PM
  3. v139h Redirect Issue
    By gin27 in forum General Questions
    Replies: 4
    Last Post: 20 Apr 2012, 03:25 AM
  4. Redirect Issue
    By tatebn in forum General Questions
    Replies: 9
    Last Post: 30 Jun 2009, 01:11 AM
  5. 301 Redirect issue
    By mw4kids in forum General Questions
    Replies: 16
    Last Post: 12 Mar 2009, 06:58 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR