WordPress.org

Ready to get started?Download WordPress

Forums

Conflicting .htaccess help - what to do? (7 posts)

  1. ckk09
    Member
    Posted 1 year ago #

    I'm running two sites on one server. The main site (www.tryobx.com) is a non-Wordpress site in the root folder. I also bought http://www.tryobx.net and 301'ed the .net url to the .com. It works great!

    However, the problem comes into play with my small WordPress side-site on the same server, http://www.thriveobx.com. It goes to a directory '/thriveobx'. I also bought thriveobx.net and 301'ed that to the .com, just like the main site.

    The problem that I'm having is the .htaccess for all of the 301's above is located in the root folder. It works on the main site (tryobx), but not on the WordPress side-site (thriveobx). I think it's because WordPress has it's own .htaccess that is competing.

    Here's my main site .htaccess from the Root Folder:

    rewriteengine on
    rewritecond %{HTTP_HOST} ^thriveobx.com$
    rewriterule ^thriveobx\/(.*)$ "http\:\/\/www\.thriveobx\.com\/$1" [R=301,L] #5091f2c716535
    rewritecond %{HTTP_HOST} ^tryobx.com$
    rewriterule ^(.*)$ "http\:\/\/www\.tryobx\.com\/$1" [R=301,L] #5091f29377f14
    rewritecond %{HTTP_HOST} ^www.thriveobx.net$ [OR]
    rewritecond %{HTTP_HOST} ^thriveobx.net$
    rewriterule ^(.*)$ "http\:\/\/www\.thriveobx\.com\/$1" [R=301,L] #5091d3a48108d
    rewritecond %{HTTP_HOST} ^www.tryobx.net$ [OR]
    rewritecond %{HTTP_HOST} ^tryobx.net$
    rewriterule ^(.*)$ "http\:\/\/www\.tryobx\.com\/$1" [R=301,L] #5091d2aaafcc6

    Here's the WordPress .htaccess from the '/thriveobx' folder housing the WordPress install:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Does anyone know how I can resolve the conflict? I was thinking about pulling the thriveobx.net and thriveobx.com lines from the main site .htaccess and adding them to the WordPress .htaccess?

    Any help is appreciated!!

  2. ckk09
    Member
    Posted 1 year ago #

    Just to clear one thing up on the root .htaccess...

    There's 2 entries just to make sure www's are always added if you come in to either of the .com domains without a www-prefix.

    Then, there's 2 more that should forward the .net's to the .com's regardless of with or without the prefix.

    Hope this helps! Thanks again for any help you can offer!

  3. ckk09
    Member
    Posted 1 year ago #

    I tried adding to the WordPress .htaccess with no luck, but I have absolutely no idea what I'm doing. Hoping someone else knows how to manipulate it.

  4. MickeyRoush
    Member
    Posted 1 year ago #

    First your root folder .htaccess has a lot of errors. I've cleaned it up so that others can read it better.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^thriveobx.com$
    RewriteRule ^thriveobx/ http://www.thriveobx.com\$1 [R=301,L] #5091f2c716535
    RewriteCond %{HTTP_HOST} ^tryobx.com$
    RewriteRule .* http://www.tryobx.com/$1 [R=301,L] #5091f29377f14
    RewriteCond %{HTTP_HOST} ^www\.thriveobx\.net$ [OR]
    RewriteCond %{HTTP_HOST} ^thriveobx\.net$
    RewriteRule .* http://www.thriveobx.com/$1 [R=301,L] #5091d3a48108d
    RewriteCond %{HTTP_HOST} ^www\.tryobx\.net$ [OR]
    RewriteCond %{HTTP_HOST} ^tryobx\.net$
    RewriteRule .* http://www.tryobx.com/$1 [R=301,L] #5091d2aaafcc6

    Note that it's more efficient now. You were escaping items that didn't need escaping and nothing needs to or is allowed to be escaped in the "target". You also didn't escape where needed in the conditions.

    In your thriveobx folder change the .htaccess as follows:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /thriveobx/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /thriveobx/index.php [L]
    </IfModule>
    
    # END WordPress

    Notice the addition of the directory in the path?

  5. ckk09
    Member
    Posted 1 year ago #

    Thanks for your help.

    So, I've updated the .htaccess files with the code you posted. The 301 redirects for thriveobx still don't seem to be working.

    Also, now if you click around on thriveobx, I'm getting some internal server errors.

    I wonder what else could be conflicting, here.

  6. MickeyRoush
    Member
    Posted 1 year ago #

    Not sure. I basically just cleaned up your first set of code, then I offered a suggestion for the default WordPress Permalink code. The second set of codes may not work if you didn't install WordPress like I'm assuming, so unless I set it up, there's no way for me to be positive.

    I cleaned up the code again.

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

    But I'm not sure how this works with multiple domains like that. It's just a guess. On a single domain it would seem like it should work, but with two domains like that, I'm not sure.

  7. ckk09
    Member
    Posted 1 year ago #

    Okay, this is the way to go... the plugin is called "Domain-Change". You install it, enter the .net domain, and it forwards it to the .com domain.

    It doesn't touch the .htaccess file. It still claims to be a 301 redirect, for search engines.

    http://wordpress.org/extend/plugins/domain-change/

Topic Closed

This topic has been closed to new replies.

About this Topic