Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: htaccess redirect from old subdirectory site to new subdomain site

    Quote Originally Posted by Millie63 View Post
    ... In awstats however, both addon domains show as subdomains of the primary domain - but I guess this doesn't matter much as only I see the awstats. ... I read somewhere that I should probably have [R301] redirects for both the addon domains to redirect subdomain.primarydomain.com to domain.com (i.e artwebsite.ecl.com to artwebsite.com) for SEO reasons. What's your take on this?
    ...
    Unless another.domain.tld is linked to, most SEs will never see another.domain.tld (only the add-on domain's name). But to be on the safe side one could redirect all requests to a specific FQDN (Fully Qualified Domain Name). Keep in mind Zen Cart will only generate links using the defined values of HTTP_SERVER and HTTPS_SERVER (which should contain the desired FQDNs).

    Code:
    ###############################################################################
    # Enable mod_rewrite processing using the rules in this .htaccess file
    ###############################################################################
    # Notes: 
    #
    # 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.
    #
    # These directives should only appear once in the .htaccess file
    ###############################################################################
    #Options +FollowSymLinks
    RewriteEngine on
    
    ###############################################################################
    # Redirect to the desired FQDN if the request was not for the desired FQDN
    ###############################################################################
    # Notes: 
    #
    # This utilizes a HTTP/301 response. Any POST data will be discarded. 
    ###############################################################################
    RewriteCond %{HTTP_HOST} !host\.domain\.tld$ [NC]
    RewriteRule ^.*$ http://host.domain.tld%{REQUEST_URI} [R=301,QSA,L]
    
    ###############################################################################
    # Remove "zencart" if present from the request URI
    ###############################################################################
    # Notes:
    #
    # Some servers add a leading slash "/" and others do not. This rule attempts
    # to handle both, but one may need to alter this by hand on some servers.
    ###############################################################################
    RewriteCond %{REQUEST_URI} ^/?zencart/
    RewriteRule ^(/?)zencart/(.*)$ $1$2
    
    ###############################################################################
    # CEON URI Mapping
    ###############################################################################
    Last edited by lhungil; 29 May 2014 at 10:37 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

 

 

Similar Threads

  1. v151 Need to redirect from old site links (including search engine links) too new site
    By swdynamic in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 15 Jun 2015, 04:40 AM
  2. What do I need in .htaccess to redirect to my new site?
    By marvin in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 18 Mar 2013, 09:01 PM
  3. Redirect From Old Site To New Site
    By devlin in forum General Questions
    Replies: 4
    Last Post: 14 Mar 2012, 01:25 PM
  4. v150 Redirect from old osc site to new zc site?
    By DIHI in forum General Questions
    Replies: 2
    Last Post: 2 Feb 2012, 05:42 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