Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Oct 2005
    Posts
    287
    Plugin Contributions
    0

    red flag 301 Redirect Rules

    Trying to redirect www and non www urls to https

    The below does the job of redirecting all www to https using 301
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    The below does it for the non www's
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
    RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]

    Can anybody give me just a single rule to 301 redirect all url's to https

    Can't understand where I am wrong.

    Thanks

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

  3. #3
    Join Date
    Oct 2005
    Posts
    287
    Plugin Contributions
    0

    red flag Re: 301 Redirect Rules

    Can you please past the specific codes for Zencart here ?
    Thanks

  4. #4
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,694
    Plugin Contributions
    9

    Default Re: 301 Redirect Rules

    rather than use htaccess redirects i would review this:

    https://www.zen-cart.com/showthread....irect-to-https

    and then add 3 new files listed here:

    https://github.com/zencart/zencart/pull/1525/files

    as long as you setup the 2 servers as listed in the first post:

    https://www.zen-cart.com/showthread....02#post1336302

    you should be fine. and i think this should work in v154.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  5. #5
    Join Date
    Apr 2009
    Posts
    60
    Plugin Contributions
    0

    red flag Re: 301 Redirect - ZEN ,htaccess not working

    HELP PLEASE!

    I have 1.5.5f that was moved from a test server to my main server by Anne. I am having trouble with redirects. I am getting this 404 error:

    The requested URL /cgi/commerce.cgi was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


    I see this zen .httaccess file she must have installed.

    Code:
    # deny *everything*
    <FilesMatch ".*">
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
      </IfModule>
    </FilesMatch>
    
    # but now allow just *certain* necessary files:
    <FilesMatch "(?i).*\.(js|css|html?|ico|jpe?g|gif|webp|png|swf|flv|xml|xsl|otf|ttf|woff|eot|svg|map)$">
      <IfModule mod_authz_core.c>
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Allow from all
      </IfModule>
    </FilesMatch>
    
    IndexIgnore */*
    
    <limit POST PUT>
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
      </IfModule>
    </limit>
    
    
    ## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
    # OPTIONS -Indexes -ExecCGI
    
    
    
    ##################
    ## Optional caching improvements
    ## Requires mod_header and mod_deflate to be enabled within Apache
    ##################
    <IfModule mod_headers.c>
      Header unset Pragma
      FileETag None
      Header unset ETag
      #Header set Cache-Control "no-transform"
      <FilesMatch "(?i).*\.(ico|jpe?g|gif|webp|png|otf|swf|flv|ttf|woff|eot|svg)$">
        Header set Cache-control "max-age=864000, public, must-revalidate"
        Header unset Last-Modified
      </FilesMatch>
      <FilesMatch "(?i).*\.(html|htm|xml|txt|xsl)$">
        Header set Cache-control "max-age=7200, must-revalidate"
      </FilesMatch>
    </IfModule>
    <IfModule mod_deflate.c>
      <FilesMatch "(?i)\.(js|css)$">
        SetOutputFilter DEFLATE
      </FilesMatch>
    </IfModule>
    
    ##################
    ## Optional improvements
    ## Requires mod_expires to be enabled within Apache
    ##################
    <ifmodule mod_expires.c>
      ExpiresActive On
      ExpiresDefault A300
      ExpiresByType application/x-javascript A3600
      ExpiresByType text/css A3600
      ExpiresByType image/gif A604800
      ExpiresByType video/x-flv A604800
      ExpiresByType application/pdf A604800
      ExpiresByType text/html A300
      ExpiresByType image/x-icon A86400
      ExpiresByType image/jpeg A2592000
      ExpiresByType image/png A2592000
    </ifmodule>

    I have written one like this with more redirect links:

    Code:
    rewriteengine on
    rewritecond %{HTTPS} off
    rewritecond %{HTTP_HOST} ^www.uesakabarbell.com$ [OR]
    rewritecond %{HTTP_HOST} ^uesakabarbell.com$
    rewriterule ^ "https\:\/\/uesakabarbell\.com\/" [R=301,L]
    
    Redirect 301 /cgi/commerce.cgi?search=action&category=1200 https://www.uesakabarbell.com/index.php?main_page=index&cPath=1&zenid=tnr05tnljf1rotfd5ng1s4dca0
    
    Redirect 301 /cgi/commerce.cgi?search=action&category=1100 https://www.uesakabarbell.com/index.php?main_page=index&cPath=2&zenid=tnr05tnljf1rotfd5ng1s4dca0
    
    Redirect 301 /?do=custom https://www.uesakabarbell.com/index.php?main_page=index&cPath=3&zenid=tnr05tnljf1rotfd5ng1s4dca0
    
    Redirect 301 /?do=company https://www.uesakabarbell.com/index.php?main_page=FILENAME_ABOUT_US&zenid=tnr05tnljf1rotfd5ng1s4dca0
    
    Redirect 301 /index.php?do=contact https://www.uesakabarbell.com/index.php?main_page=contact_us&zenid=tnr05tnljf1rotfd5ng1s4dca0
    I do not know what the one she has does. I am not sure if I can add my links to that existing one? Can I replace hers with this one?

    I also see these files in my root directory:

    page_not_found.php
    ipn_main_handler.php
    mcs_learn_more.html
    nddbc.html
    square_handler.php
    vbv_learn_more.html

    Not sure what they do.

    It seems like there is more issues based on the 404 Not Found error. I have not gotten any replies from her and I need help on figuring this out.

    Thank you in advance for any advise!

  6. #6
    Join Date
    Apr 2009
    Posts
    60
    Plugin Contributions
    0

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Update, I combined the two htaccess files and still have same error. Any ideas? This site has been up for 10 years ranking good. Now I am in trouble.

    Thanks,

    Max

  7. #7
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,154
    Plugin Contributions
    11

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Looks like you had more than on cart on the old site. commerce.cgi is associated with another cart. As a quick fix, if you have a copy of the old site, load the file into the cgi folder to see if it works.

    Redirects will probably not work in this case.

  8. #8
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,694
    Plugin Contributions
    9

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Quote Originally Posted by dbltoe View Post
    Looks like you had more than on cart on the old site. commerce.cgi is associated with another cart. As a quick fix, if you have a copy of the old site, load the file into the cgi folder to see if it works.

    Redirects will probably not work in this case.
    i’m sorry. i do not agree.

    redirects will work. they are just not set up correctly.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  9. #9
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,154
    Plugin Contributions
    11

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Was referring to redirecting the .cgi file. Have you had success doing this?

  10. #10
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,694
    Plugin Contributions
    9

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Quote Originally Posted by dbltoe View Post
    Was referring to redirecting the .cgi file. Have you had success doing this?
    .htaccess is one of the first things to do redirects. i have not tried in the past, but my quick test suggests it can be done.

    the initiator for both of these was:

    https://mytestsite.com/cgi/commerce....&category=1200

    before .htaccess rule:
    Click image for larger version. 

Name:	Screenshot from 2018-06-26 12-13-52.png 
Views:	48 
Size:	10.9 KB 
ID:	17951

    after .htaccess rule:
    Click image for larger version. 

Name:	Screenshot from 2018-06-26 12-13-11.png 
Views:	41 
Size:	11.1 KB 
ID:	17952

    i am NOT the apache/.htaccess rule king, which is why i'm hesitant to add anything on the topic. but asking someone to load a file from an old site to see if it works strikes me as a bad path to go down for troubleshooting this situation.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 
Page 1 of 3 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. 301 Redirect
    By philip937 in forum General Questions
    Replies: 3
    Last Post: 16 Feb 2010, 05:55 PM
  3. 301 Redirect
    By camslozano in forum General Questions
    Replies: 1
    Last Post: 3 Oct 2009, 10:54 PM
  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