Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Feb 2005
    Posts
    219

    Default mod_rewrite and add-on domains

    I know this is more of an apache question than a cPanel question, but it connects to the way cPanel sets up add-on domains, so asking here.

    Given main domain blue.com and the add-on domain green.com, the customer doesn't want his Google pagerank confused by having blue.com and www.blue.com both equally available. All requests for www.blue.com should resolve to blue.com. So we set up this rewrite rule:


    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^blue\.com
    RewriteRule ^.*$ http://blue.com%{REQUEST_URI} [R=301,L]
    Which works fine for blue.com. But because in cPanel green.com is a directory under blue's public_html, the .htaccess for blue.com also affects green.com. This is a problem in general, but here specifically, what happens is that the condition is matched for ALL requests on green.com, the rule kicks in, and the browser is redirected to blue.com.

    Is there a way to make the .htaccess for blue.com NOT affect green.com?

    And no, putting a separate/equivalent .htaccess in the green dir does not fix it

    Thanks,
    Scot

  2. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,495

    Default

    You have to turn off mod_rewrite in the .htaccess file for green.com:

    RewriteEngine off
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  3. #3
    Member
    Join Date
    Feb 2005
    Posts
    219

    Default

    Ah, of course. And then if I wanted green.com to have its own set of rules, I assume I could just turn it back on in its own .htaccess.

    Will experiment. Thanks.

Similar Threads & Tags
Similar threads

  1. Listing Add-on domains only. Not add-on + sub domains
    By colinireland in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-13-2011, 04:33 PM
  2. Replies: 0
    Last Post: 11-10-2010, 08:13 PM
  3. Replies: 2
    Last Post: 02-11-2007, 03:29 AM
  4. Can I make active domains as add-on domains?
    By RubyRailer in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-18-2007, 12:01 PM
  5. Is there a problem adding sub-domains to add-on domains??
    By DWHS.net in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-08-2003, 05:21 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube