Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Get rid of all the htaccess and see what happens. Site should be OK at that point.

    Then re-instate all the rules in the top box of your first post. These just have to do with caching and a bit of basic security. Check the site again.

    Once you know that that all works have a look at the second set of rules. You will need to add them to the same htaccess file. They are basically a set of redirects from some other system that you used to have before to Zen Cart. Add them in one at a time and see what breaks. ( They probably can go above the other ones )


    It is worth noting that the URLs in the htaccess rules should NOT have the zenid in the URL. It is a security ooops. Take it out.

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

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Yeah, it's like opening a file in Word. You can go at it from different ways. Throwing the file in might not be the best and not what I would always do, but if I have a site that didn't work after a move and gave me a 404, I'd be looking to get that file back in there. If that bombs, we go from there if we get another error.

    Not beating the horse. Just as you would think twice about adding the file, I'd think more than twice about fixing a 404 with a 301. It's all apples and watermelons I guess

  3. #13
    Join Date
    Apr 2009
    Posts
    60
    Plugin Contributions
    0

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Okay if I delete the .htaccess file the site works, but if a link is followed from a blog leading to a link on the old site:

    Not Found
    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.


    My dreamweaver overwrote the original Zen .htccess file I believe it was written by Dr. Byte. Starting in small steps, I took the code I pasted previously in the first post and this is what I get going to the site:

    Forbidden
    You don't have permission to access /index.php on this server.
    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


    Does anyone have a copy of the entire page? I must be missing something in here.

    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
    So then I put this:

    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
    
    Redirect 301 /cgi/commerce.cgi?search=action&category=1100 https://www.uesakabarbell.com/index.php?main_page=index&cPath=2
    Then I get back to this:
    Not Found
    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 thought the redirects are for old links out there will take them to the new location...?

    I have an empty cgi bin on the server.

    I also have the original code that goes in it as well.

    I am not sure what the next step should be?

    Thanks!

  4. #14
    Join Date
    Apr 2009
    Posts
    60
    Plugin Contributions
    0

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Okay this is what I did in .htaccess file. Is this okay to have both of these in?

    Code:
    Options -Indexes
    ErrorDocument 404 /page_not_found.php
    ErrorDocument 403 /page_not_found.php
    
    rewriteengine on
    rewritecond %{HTTPS} off
    rewritecond %{HTTP_HOST} ^www.uesakabarbell.com$ [OR]
    rewritecond %{HTTP_HOST} ^uesakabarbell.com$
    rewriterule ^ "https\:\/\/uesakabarbell\.com\/" [R=301,L]
    There is a page in my root > page_not_found.php which brings me to a custom error page that has the site map links.

    My goal was to redirect each link from my old cart to my new cart. Isn't that what I should be doing for SEO? Is there some other way I should be doing this?

    Thanks!

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

    Default Re: 301 Redirect - ZEN ,htaccess not working

    I guess, I better pay some attention here rather than just writing on my phone :-)

    (1)
    Your 301s are badly formed:
    https://stackoverflow.com/questions/...-url-variables

    (2)
    That looks like the htaccess from the images directory. If you use it for the whole site then it will prevent functionality.


    So, not sure what previous people have done but I would
    (1) get rid of everything in the root htaccess
    (2) add the www. redirect at the top of the site htaccess
    (3) add the 301 redirects but correctly formatted
    (3) personally I would add the caching stuff as well

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

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Are you saying just put this in there? I used a online site to generate the 301s because I didn't understand it.

    Thanks


    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]
    
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^id=([^&]+)
    RewriteRule ^/?product\.php$ http://website.com.au/product_%1.php? [L,R=301]
    
    <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>

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

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Here's a generator that seems to get it right:

    https://websiteadvantage.com.au/HtAc...rect-Generator

    That will let you make the 301s that you want. And if you read the blurb under the tool then you may start to understand what is being done.

  8. #18
    Join Date
    Aug 2005
    Posts
    334
    Plugin Contributions
    0

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Hello,

    We have a problem with 301 Redirect using .htaccess file.

    Goals are:

    1. to satisfy Google analytics to define canonical URL https://www.idmedicaltags.com/

    2. to refer previously located site at idmedicaltags.com/store to https://www.idmedicaltags.com/

    We used following tool to generate redirect code:

    https://websiteadvantage.com.au/HtAc...ing-ToolResult

    and we are using following tool to check redirect:

    https://www.internetmarketingninjas.com/header-checker/

    We manually copy lines to .htaccess file.

    PHP Code:
    # Needed before any rewriting 
    RewriteEngine On 

    ### Built using the .htaccess 301 Redirect Generator from Web Site Advantage 
    ### https://websiteadvantage.com.au/HtAccess-301-Redirect-Generator 
    ### Place after 'RewriteEngine On' and before any CMS specific rewrite rules 

    # Redirect HTTP with www to HTTPS with www 
    RewriteCond %{HTTPSoff 
    RewriteCond 
    %{HTTP_HOST} ^www\. [NC
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 
    # Redirect HTTP without www to HTTPS with www 
    RewriteCond %{HTTPSoff 
    RewriteCond 
    %{HTTP_HOST} !^www\. [NC
    RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

    # Redirect HTTPS without www to HTTPS with www                     <-trouble
    RewriteCond %{HTTPSon                                            <-trouble
    RewriteCond 
    %{HTTP_HOST} !^www\. [NC]                              <-trouble
    RewriteRule 
    .* https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]    <-trouble

    RewriteCond %{HTTP_HOST} ^idmedicaltags\.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^www\.idmedicaltags\.com
    RewriteRule ^store\/?(.*)$ "https\:\/\/www\.idmedicaltags\.com\/$1" [R=301,L
    Shown above code works for redirect as designed.

    But, when lines which are marked "trouble" do exist we can not login to ZenCart Admin. (It was found by using method of elimination.)
    This means there is no errors of any kind. When user name and password are entered and Submit button is clicked, both fields (user name and password) are cleared.

    If we remove those 'trouble" lines everything works normal again.

    We checked this on two different domains and it acts the same.

    Is there any conflict between "trouble' lines and Zen Cart admin?
    What can be done to overcome this?

    Thank you.

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

    Default Re: 301 Redirect - ZEN ,htaccess not working

    Just a WAG, YOUR_ADMIN/includes/configure.php is not set to https://www.idmedicaltags.com for all settings.

  10. #20
    Join Date
    Aug 2005
    Posts
    334
    Plugin Contributions
    0

    Default Re: 301 Redirect - ZEN ,htaccess not working

    By deeping more in the forum threads we found very good and simple solution advised by mprough:

    https://www.zen-cart.com/showthread....my-admin/page2

    "So to answer the question... If you are rewriting with the redirect you can simply turn of the rewrite engine off in the first line of your Admin folder's .htaccess. ".

    Code:

    PHP Code:
    RewriteEngine off 
    In our case we put this line in the end and it worked too.

    Thank you mprough
    Last edited by idtags; 11 Nov 2018 at 04:22 PM.

 

 
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. 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