Page 1 of 3 123 LastLast
Results 1 to 10 of 26
  1. #1
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    red flag redirects in htacess help

    ###############################################################################
    # Add any custom 301 redirects
    hey guys trying to redirect my http:// to www or something like that just dont want duplicate content
    now i put the below code into my .htacess file and redirects work as they should but if i got to a product on my site and add to cart just brings up your shopping cart is empty and doesn't add item to cart. if i remove this redirect items will get added to cart fine anyone please help.

    ###############################################################################
    # Notes:
    #
    # In general these should be few and far between. If you use a RewriteRule
    # be sure to add the L flag to let Apache mod_rewrite know to stop processing
    # and skip any RewriteRules defined later in the .htaccess file.
    ###############################################################################
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.anarchyangels\.net
    RewriteRule (.*) http://www.anarchyangels.net/$1 [R=301,L]
    </IfModule>

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: redirects in htacess help

    Try the following
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.anarchyangels.net$
    RewriteRule ^(.*)$ http://www.anarchyangels.net/$1 [R=301]

  3. #3
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: redirects in htacess help

    thanks for the reply mate but this just returns a blank page lol you would think a 301 redirect would be easy lol frustrating

  4. #4
    Join Date
    Jun 2010
    Location
    Austria
    Posts
    115
    Plugin Contributions
    0

    Default Re: redirects in htacess help

    The code given above should work, same one I use on sites.

    Have you made sure that in your site's /include/configure.php (frontend & admin), you are using "www.anarchyangels.net" as domain name?

  5. #5
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: redirects in htacess help

    Quote Originally Posted by terraGirl View Post
    The code given above should work, same one I use on sites.

    Have you made sure that in your site's /include/configure.php (frontend & admin), you are using "www.anarchyangels.net" as domain name?
    Having followed the link, the answer is no, the server information for the store side of the ZC store is set to exclude the www. Not exactly sure why the old school www. Is trying to be forced, but first ZC needs to have the uri that is expected to be had before pushing visitors to one direction or the other.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: redirects in htacess help

    Ok I didn't realise I had to check config.php just was putting it into the .htacess file my origianl code I got worked I got that from ZenCart instructions sure it said to put it into the htacess file is is there a guid for ZenCart to show all steps required so I don't make a mess lol thanks in advance:)

  7. #7
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: redirects in htacess help

    Also I was trying to force the www as this is what has been set in Google tools and read that you should use 301 redirects to stop getting bad rankings

  8. #8
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: redirects in htacess help

    includes/config.php

    define('HTTP_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_SERVER', 'https://www.anarchyangels.net');
    define('HTTP_CATALOG_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_CATALOG_SERVER', 'https://www.anarchyangels.net');

    admin/includes/config.php

    define('HTTP_SERVER', 'http://anarchyangels.net');
    define('HTTPS_SERVER', 'https://anarchyangels.net');
    define('HTTP_CATALOG_SERVER', 'http://anarchyangels.net');
    define('HTTPS_CATALOG_SERVER', 'https://anarchyangels.net');

    lol shouldn't these match
    can i just edit these without breaking my site

  9. #9
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,845
    Plugin Contributions
    25

    Default Re: redirects in htacess help

    Yes, they should match. If the site is setup properly, you can change one file to match the other, without breaking the site.
    Quote Originally Posted by mydakota View Post
    includes/config.php

    define('HTTP_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_SERVER', 'https://www.anarchyangels.net');
    define('HTTP_CATALOG_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_CATALOG_SERVER', 'https://www.anarchyangels.net');

    admin/includes/config.php

    define('HTTP_SERVER', 'http://anarchyangels.net');
    define('HTTPS_SERVER', 'https://anarchyangels.net');
    define('HTTP_CATALOG_SERVER', 'http://anarchyangels.net');
    define('HTTPS_CATALOG_SERVER', 'https://anarchyangels.net');

    lol shouldn't these match
    can i just edit these without breaking my site

  10. #10
    Join Date
    Feb 2016
    Posts
    58
    Plugin Contributions
    0

    Default Re: redirects in htacess help

    ok i changed them both to


    define('HTTP_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_SERVER', 'https://www.anarchyangels.net');
    define('HTTP_CATALOG_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_CATALOG_SERVER', 'https://www.anarchyangels.net');

    then added
    Code:
    ###############################################################################
    # Add custom headers and options
    ###############################################################################
    # Notes:
    #
    # Examples: Adding IE compatibility / edge flags, language and encoding flags,
    # php or suphp directives, configure other Apache modules such as page_speed,
    # and enable or disable Apache httpd options.
    #
    # Do NOT configure anything directly relating to physical or virtual resources
    # in this section. These should be addressed later on in this file.
    ###############################################################################
    #Options -Indexes
    
    ###############################################################################
    # Enable mod_rewrite processing using the rules in this .htaccess file
    ###############################################################################
    # Notes:
    #
    # <IfModule> should be avoided at all costs. If mod_rewrite is not available
    # it is almost always better to return HTTP 500 status. This way we see there
    # is an issue as soon as the .htaccess file is uploaded.
    #
    # For mod_rewrite to work, the Apache server option to allow symbolic links to
    # be followed must be enabled. Most providers supporting mod_rewrite will
    # already have it enabled for you, but if your rewrite rules are not working
    # you can un-comment the first directive below to manually enable the option.
    #
    # Don't forget, mod_rewrite directives are processed in order until a matching
    # RewriteRule with the [L] flag is encountered. So the more specific a rule is
    # the closer it should appear to the top of this file.
    ###############################################################################
    #Options +FollowSymLinks
    RewriteEngine on
    
    ###############################################################################
    # Tell mod_rewrite where this file is relative to the server document_root
    ###############################################################################
    # Notes:
    #
    # This directive should only be enabled if this .htaccess file is not placed
    # in the document_root (usually public_html, www, or web) of the (sub)domain.
    #
    # An easy way to determine the location relative to the server document_root is
    # to look at the URL used to access a file in this folder. For example if you
    # access a "page" in the same folder as this file by typing in the URL
    # "www.mydomain.com/myfolder/index.html" then "myfolder" will be the location
    # of this file relative to the server document_root.
    #
    # Another quick and easy way to determine the correct setting for this is to
    # look at the defined value for DIR_WS_CATALOG and DIR_WS_HTTPS_CATALOG in
    # Zen Cart's configure.php files. All three values should match.
    #
    # Don't forget the leading and trailing /. This directive requires both!
    ###############################################################################
    #RewriteBase /shop/
    
    
    ###############################################################################
    # Redirect if request was for index.php (no query)
    ###############################################################################
    # Notes:
    #
    # This is only required if the site generates references to index.php with no
    # parameters. This rule will force a 301 redirect to the site root when a
    # request is made for "/index.php" with no query terms (?key=value).
    ###############################################################################
    #RewriteCond %{QUERY_STRING} ^$
    #RewriteRule ^index\.php$ / [R=301,L]
    
    
    ###############################################################################
    # Add any custom 301 redirects
    ###############################################################################
    # Notes:
    #
    # In general these should be few and far between. If you use a RewriteRule
    # be sure to add the L flag to let Apache mod_rewrite know to stop processing
    # and skip any RewriteRules defined later in the .htaccess file.
    ###############################################################################
    define('HTTP_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_SERVER', 'https://www.anarchyangels.net');
    define('HTTP_CATALOG_SERVER', 'http://www.anarchyangels.net');
    define('HTTPS_CATALOG_SERVER', 'https://www.anarchyangels.net');
    
    ###############################################################################
    # Redirect if request was for index.php (with or without query)
    ###############################################################################
    # Notes:
    #
    # This is a performance optimization. If the request is for index.php simply
    # pass the request on and do not process any other mod_rewrite directives in
    # this file.
    #
    # Basically this avoids the overhead of checking if index.php is a real file
    # or directory (used in subsequent mod_rewrite rules) before sending the
    # request to index.php.
    ###############################################################################
    RewriteRule ^index\.php$ - [L]
    
    
    ###############################################################################
    # Start Ultimate (SEO) URLs
    ###############################################################################
    # Notes:
    #
    # You should not make any changes in this section unless you really understand
    # how it will impact your web site. Mistakes can break things.
    ###############################################################################
    
    # Handles the new URL formats
    RewriteRule ^(.*)-c-([0-9_]+)/(.*)-p-([0-9]+)(.*)$ index\.php?main_page=product_info&products_id=$4&cPath=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-c-([0-9_]+)/(.*)-pi-([0-9]+)(.*)$ index\.php?main_page=popup_image&pID=$4&cPath=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-c-([0-9_]+)/(.*)-pr-([0-9]+)(.*)$ index\.php?main_page=product_reviews&products_id=$4&cPath=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-c-([0-9_]+)/(.*)-pri-([0-9]+)(.*)$ index\.php?main_page=product_reviews_info&products_id=$4&cPath=$2&%{QUERY_STRING} [L]
    
    # Original (unchanged) URL formats
    RewriteRule ^(.*)-p-([0-9]+)(.*)$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-m-([0-9]+)(.*)$ index\.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pi-([0-9]+)(.*)$ index\.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pr-([0-9]+)(.*)$ index\.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-pri-([0-9]+)(.*)$ index\.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-ezp-([0-9]+)(.*)$ index\.php?main_page=page&id=$2&%{QUERY_STRING} [L]
    RewriteRule ^(.*)-c-([0-9_]+)(.*)$ index\.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
    
    # Rewrite all other requests (if the file / directory does not exist)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index\.php?main_page=$1&%{QUERY_STRING} [L]
    
    ###############################################################################
    # Add any other directives relating to the handling of physical files
    ###############################################################################
    # Notes:
    #
    # If processing makes it this far, the request was for a real file or folder.
    # Example: Adding further processing related to browser caching or security.
    ###############################################################################
    this returns a blank page with http://anarchyangels.net but ok with www.

    but if i use this code
    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.anarchyangels\.net
    RewriteRule (.*) http://www.anarchyangels.net/$1 [R=301,L]
    </IfModule>
    everything redirects and seems to work ok except when adding product to cart just returns to page your shopping cart is empty
    hope that makes sense

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Htacess
    By meltdowncomics in forum General Questions
    Replies: 4
    Last Post: 9 Apr 2011, 10:39 PM
  2. Too many redirects? HELP
    By Uthernator in forum General Questions
    Replies: 1
    Last Post: 29 Sep 2010, 10:36 AM
  3. htacess settings
    By gregger in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 23 Jan 2010, 10:18 AM
  4. Help with .htacess and configure files to stop SSL redirect loop
    By behrtek in forum Installing on a Linux/Unix Server
    Replies: 7
    Last Post: 5 Mar 2009, 08:35 PM

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