WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 2 htaccess files and can't seem to combine (17 posts)

  1. baemiller
    Member
    Posted 3 years ago #

    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

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Have you tried asking your hosts about the _htaccess file?

  3. baemiller
    Member
    Posted 3 years ago #

    Am checking on it.

  4. baemiller
    Member
    Posted 3 years ago #

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

  5. iliveudie123
    Member
    Posted 3 years ago #

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

  6. baemiller
    Member
    Posted 3 years ago #

    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?

  7. iliveudie123
    Member
    Posted 3 years ago #

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

  8. webjunk
    Member
    Posted 3 years ago #

    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.

  9. baemiller
    Member
    Posted 3 years ago #

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

  10. iliveudie123
    Member
    Posted 3 years ago #

    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.

  11. baemiller
    Member
    Posted 3 years ago #

    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.

  12. iliveudie123
    Member
    Posted 3 years ago #

    # 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...

  13. baemiller
    Member
    Posted 3 years ago #

    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.

  14. webjunk
    Member
    Posted 3 years ago #

    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>
  15. baemiller
    Member
    Posted 3 years ago #

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

  16. webjunk
    Member
    Posted 3 years ago #

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

  17. baemiller
    Member
    Posted 3 years ago #

    Thank you, thank you! Worked like a charm. I am just learning all this. Can you tell? : ) Trying to learn PHP, WordPress, Apache, HTML, AND CSS all at the same time is an overwhelming task. I so appreciate people like you who are willing to help others learn. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Topic