Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2013
    Posts
    345
    Plugin Contributions
    0

    Default putting redirect in my htaccess file

    i want to put in my htaccess file a redirect from non www inquiries to www. for my website..

    for example, redirect all domain.com to www.domain.com

    i have coding that will do that

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


    but there is already existing coding in my htaccess that i don't want to mess up. coding for zen cart?? and for ceon_uri_mapping.. here is the coding already in there:

    ## BEGIN CEON URI MAPPING REWRITE RULE

    RewriteEngine On

    # Don't rewrite any URIs ending with a file extension (ending with .[xxxxx])
    RewriteCond %{REQUEST_URI} !\.[a-zA-Z]{2,5}$ [OR]
    RewriteCond %{REQUEST_URI} \.(html)$ [NC]
    # Don't rewrite any URIs for some, popular specific file format extensions,
    # which are not covered by main file extension condition above
    RewriteCond %{REQUEST_URI} !\.(mp3|mp4|h264)$ [NC]
    # Don't rewrite any URIs for some specific file format extensions,
    # which are not covered by main file extension condition above
    # Uncomment the following line to apply this condition! (Remove the # at the start of the next line)
    #RewriteCond %{REQUEST_URI} !\.(3gp|3g2|h261|h263|mj2|mjp2|mp4v|mpg4|m1v|m2v|m4u|f4v|m4v|3dml)$ [NC]
    # Don't rewrite admin directory
    RewriteCond %{REQUEST_URI} !^/adminhiddenxxxxxx [NC]
    # Don't rewrite editors directory
    RewriteCond %{REQUEST_URI} !^/editors/ [NC]
    # Don't rewrite logs directory
    RewriteCond %{REQUEST_URI} !^/logs/ [NC]
    # Don't rewrite catalog directory
    RewriteCond %{REQUEST_URI} !^/catalog/ [NC]
    # Don't rewrite tempEP directory
    RewriteCond %{REQUEST_URI} !^/tempEP/ [NC]
    # Don't rewrite mobile
    RewriteCond %{REQUEST_URI} !^/m/ [NC]
    # Handle all other URIs using Zen Cart (its index.php)
    RewriteRule .* index.php [QSA,L]

    ## END CEON URI MAPPING REWRITE RULE


    since i know VERY LITTLE about htaccess coding, can someone please help me here.. btw, the admin directory is of course not real..

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

    Default Re: putting redirect in my htaccess file

    This should be handled by adding the www to your configure.php files

    Store side file
    Code:
      define('HTTP_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTPS_SERVER', 'https://www.xxxxxxxx.com');
    Admin side file
    Code:
      define('HTTP_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTPS_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTP_CATALOG_SERVER', 'http://www.xxxxxxxx.com');
      define('HTTPS_CATALOG_SERVER', 'https://www.xxxxxxxx.com');
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: putting redirect in my htaccess file

    Quote Originally Posted by lidlchris View Post
    i want to put in my htaccess file a redirect from non www inquiries to www. for my website..
    No need to do this. ZC handles canonical issues already with
    PHP Code:
    <?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
    <link rel="canonical" href="<?php echo $canonicalLink?>" />
    <?php ?>
    in the html_header.php files

    And there's also no need to (or advantage in) re-writing URL's. If you think this may assist "SEO" then you are mis-informed. It has zero influence on "SEO".
    20 years a Zencart User

  4. #4
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: putting redirect in my htaccess file

    Quote Originally Posted by kobra View Post
    This should be handled by adding the www to your configure.php files

    Store side file
    Code:
      define('HTTP_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTPS_SERVER', 'https://www.xxxxxxxx.com');
    Admin side file
    Code:
      define('HTTP_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTPS_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTP_CATALOG_SERVER', 'http://www.xxxxxxxx.com');
      define('HTTPS_CATALOG_SERVER', 'https://www.xxxxxxxx.com');
    Yes... you decide whether to use www by configuring your URL as Kobra describes. As I said above, the canonical issue is largely solved by the php code in the header.
    20 years a Zencart User

  5. #5
    Join Date
    Feb 2013
    Posts
    345
    Plugin Contributions
    0

    Default Re: putting redirect in my htaccess file

    Quote Originally Posted by kobra View Post
    This should be handled by adding the www to your configure.php files

    Store side file
    Code:
      define('HTTP_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTPS_SERVER', 'https://www.xxxxxxxx.com');
    Admin side file
    Code:
      define('HTTP_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTPS_SERVER', 'https://www.xxxxxxxx.com');
      define('HTTP_CATALOG_SERVER', 'http://www.xxxxxxxx.com');
      define('HTTPS_CATALOG_SERVER', 'https://www.xxxxxxxx.com');
    ok, this didn't work BUT maybe it's because i'm using 'multi sites' mod.. but even then i went into the _config.php file for this site and set it to go to www.xxxxxx.com and yet when you type in xxxxx.com it does NOT redirect..

    are you familiar with 'multi sites'??

  6. #6
    Join Date
    Feb 2013
    Posts
    345
    Plugin Contributions
    0

    Default Re: putting redirect in my htaccess file

    Quote Originally Posted by schoolboy View Post
    No need to do this. ZC handles canonical issues already with
    PHP Code:
    <?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
    <link rel="canonical" href="<?php echo $canonicalLink?>" />
    <?php ?>
    in the html_header.php files

    And there's also no need to (or advantage in) re-writing URL's. If you think this may assist "SEO" then you are mis-informed. It has zero influence on "SEO".
    no, not doing it for SEO.. doing it for SSL so that i only need to use one version for my multi domain SSL.. don't want to use up 2 on a www.xxxxxx.com AND xxxxxx.com..

  7. #7
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: putting redirect in my htaccess file

    set it to go to www.xxxxxx.com and yet when you type in xxxxx.com it does NOT redirect.
    Click on anything - does it redirect??
    Zen-Venom Get Bitten

  8. #8
    Join Date
    Feb 2013
    Posts
    345
    Plugin Contributions
    0

    Default Re: putting redirect in my htaccess file

    Quote Originally Posted by kobra View Post
    Click on anything - does it redirect??
    yes it does.. :) thanks...

 

 

Similar Threads

  1. v150 Cannot log in after adding www. redirect to .htaccess file
    By coreyalderin in forum General Questions
    Replies: 34
    Last Post: 19 Dec 2012, 05:23 PM
  2. .htaccess redirect
    By damiantaylor in forum General Questions
    Replies: 6
    Last Post: 11 Apr 2010, 01:09 AM
  3. Replies: 1
    Last Post: 3 May 2009, 05:16 AM
  4. trying to set up a 301 redirect by editing .htaccess file
    By eggrush in forum General Questions
    Replies: 4
    Last Post: 7 Mar 2009, 02:38 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