Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: 301 redirect from zencart urls to something else

    Quote Originally Posted by lat9 View Post
    Perhaps if you'd post the current contents of your .htaccess file, that might shed some light on why it's not working.
    I did. It's all I have there at the moment to test how I need to build the other links.

    I will test this pattern and report back.
    RewriteEngine On

    RewriteCond %{QUERY_STRING} ^main_page=index&cPath=75$ [NC]
    RewriteRule ^(index\.php)?$ http://www.example.com/category/newpage? [R=301,L,NE]

    @mc12345678 and how would I add the general home page redirect old site to new site with this kind of code?
    In the end I want old domain home page redirect to new domain home page. Then individually redirect some important pages from the old site to the new with already posted examples. Seems like too much work to do for all pages. At least I want to do a few that I get backlinks from.
    Live and learn... the Zen way.

  2. #12
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: 301 redirect from zencart urls to something else

    OK, this works now.

    I can with above code create individual redirects. In order to redirect the home page, I used cpanel to create a redirect. I merged the whole thing in one .htaccess an it is now working fine.
    Code:
    RewriteEngine On
    
    
    RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule ^/?$ "https\:\/\/wholesale\.newdomain\-inc\.com\/" [R=301,L]
    
    RewriteCond %{QUERY_STRING} ^main_page=index&cPath=74$ [NC]
    RewriteRule ^(index\.php)?$ https://wholesale.newdomain-inc.com/product-category/tin-star-lights? [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^main_page=index&cPath=75$ [NC]
    RewriteRule ^(index\.php)?$ https://wholesale.newdomain-inc.com/product-category/moravian-glass-star-lights? [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^main_page=index&cPath=76$ [NC]
    RewriteRule ^(index\.php)?$ https://wholesale.newdomain-inc.com/product-category/tin-stars-with-marbles? [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^main_page=index&cPath=77$ [NC]
    RewriteRule ^(index\.php)?$https://wholesale.newdomain-inc.com/product-category/star-of-bethlehem? [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^main_page=index&cPath=78$ [NC]
    RewriteRule ^(index\.php)?$ https://wholesale.newdomain-inc.com/product-category/fiesta-stars? [R=301,L,NE]
    
    RewriteCond %{QUERY_STRING} ^main_page=products_all$ [NC]
    RewriteRule ^(index\.php)?$ https://wholesale.newdomain-inc.com? [R=301,L,NE]
    Would be nice if there was a path to construct this with all urls from the old to new. On another zen cart with ceon uri installed, it was easy to do with the googlefeed.xml and then create the redirect in excel. Not sure how I could construct it with these dynamic links. But for now my most urgent redirects are done. Let me know if you think this code is not what I should be using. Thanks!
    Last edited by mydanilo; 3 Apr 2018 at 10:06 PM.
    Live and learn... the Zen way.

  3. #13
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 301 redirect from zencart urls to something else

    So to be sure that it is understood about what was desired/what happened:

    A new domain name was acquired and is on this server.

    The previous domain name(s) that were hosted on this same server (or directed here now) are no longer providing content. The specific content from the previous domain(s) is now to be "accessible" at the new domain name.

    If that is the case, also understand that the way the above htaccess is written that there will be a minimum of two redirects to get to the final content which is at least one more than necessary and is also discouraged.

    The individual redirects already contain all of the information necessary to try to land on the correct final page for that redirect. Those should be identified and acted upon before redirecting the entire original domain(s). Doing so (placing the first grouping of rewriteCond/rewriteRule at the bottom will result in a single redirect for all links expected to be provided.

    It's just a suggestion...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #14
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: 301 redirect from zencart urls to something else

    Great, I'll switch it around as you suggest. Thanks. Your statements are basically correct.

    Yes old and new domain is hosted on the same server. BUT url structure has completely changed. Could not find an easy way to map them all. So just picking a few and also want the home page to redirect to new home page. If there is easier code to do the home page redirect and make the other individual redirects still work, I am open for suggestions. Just gave cpanel a try to add it.
    Last edited by mydanilo; 3 Apr 2018 at 10:34 PM.
    Live and learn... the Zen way.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. 301 redirect from html to php?
    By BillNally in forum General Questions
    Replies: 12
    Last Post: 31 Jul 2010, 11:43 PM
  2. Can I exclude a folder from a 301 redirect?
    By beyre in forum General Questions
    Replies: 0
    Last Post: 3 Apr 2009, 02:59 AM
  3. 301 Redirect with Ultimate SEO URLs
    By quantum in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 25 Sep 2008, 08:37 AM
  4. Replies: 14
    Last Post: 2 Jul 2008, 03:40 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