Support » Fixing WordPress » 2 htaccess files and can't seem to combine

  • Resolved baemiller

    (@baemiller)


    I have 2 files in my public directory: .htaccess and _htaccess. I’m not sure how the two got there, but the only way I can make everything work is to have my Permalink rules in the .htaccess file and the rewrite rules for setting up the network in the _htaccess file, but my concern is that is going to cause problems down the road. How do I combine the two and get everything to read the same file?

    http://hungryhappyhealthy.com

Viewing 15 replies - 1 through 15 (of 16 total)
  • esmi

    (@esmi)

    Forum Moderator

    Have you tried asking your hosts about the _htaccess file?

    Am checking on it.

    So they told me it is a WordPress problem and to try the forums. Did I mention I hate my host?

    Well, generally WordPress takes the .htaccess file and would ignore the _htaccess one. By the looks of it, what is in the 2?

    That was what I thought, but the _htaccess has all the Network rules in it. So far as I can tell, the Network is working, so it must be reading it too. Here’s what’s in it.

    # -FrontPage-

    RewriteEngine On
    RewriteBase /
    #RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]p

    # BEGIN WordPress

    # END WordPress

    The .htaccess has the following.

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

    #END WordPress

    Any ideas?

    Well…like I said…it normally takes the .htaccess content only. Why can’t you just open _htaccess and paste it into .htaccess?

    I seem to recall that _htaccess was used by a plugin. Just can not remember which one right now. And I “think” (on occassion) the settings in _htaccess can not be placed in .htaccess.
    Maybe you could list which plugins you are using?
    ALso if you place the contents (seperately) of both .htaccess and _htaccess we can gt it sorted for you pretty easy.

    I tried that. It gave me a 500 Internal Server Error. I tried just having the .htaccess and just the _htaccess. Neither worked.

    Ok, then i think webjunk may be correct…the _htacess is probably used from a plugin.

    I know that the .htaccess is used for WordPress when it is first installed.

    The only plug-in I have installed is Akismet. The problem seemed to start once I installed the MyMag theme and tried to create custom Permalinks. I put the following into my .htaccess file to try to correct the Permalink problem.

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

    #END WordPress

    That was when I noticed the other _htaccess file. I thought I had put that info in the .htaccess file and don’t remember seeing the file at all until the problem with the permalinks popped up. I guess if it works this way okay, but I can’t believe it won’t cause problems with the network if those rules are supposed to be in the .htaccess file.

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

    #END WordPress

    Is the defualt that WordPress does. It creates a .htaccess file and places the following in it.

    Also, what exactly are you trying to fix on your site right now? It looks fine…

    I guess my concern is that it will somehow mess up the network options by having the rewrite rules in a separate file. So far it seems to be working. I guess I’m being anal because I thought there was only supposed to be one file, but every time I try to merge them I get the 500 Error again. I don’t want to get down the road setting up the network and have a problem. I guess I’ll leave it as is for now until I see another problem. Thanks for all the help.

    Make a backup of both files, then try ONLY a single .htaccess with the following:

    # For Support Contact webjunk.com
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    </IfModule>

    I don’t see an #END WordPress. Is it not necessary?

    Add it to the end if you want. When a line starts with # its a comment

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘2 htaccess files and can't seem to combine’ is closed to new replies.