WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess 500 internal error (14 posts)

  1. Axon
    Member
    Posted 9 years ago #

    Hey,

    I need some help with PermaLinks. When ever I implement the .htaccess given to my by Word Press it gives me a Internal Server 500 error.
    The .htaccess it provides me is as follows:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [S=35]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /index.php?s=$1 [QSA,L]
    RewriteRule ^category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^category/(.+)/?$ /index.php?category_name=$1 [QSA,L]
    RewriteRule ^author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/page/?([0-9]{1,})/?$ /index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/?$ /index.php?author_name=$1 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/page/?([0-9]{1,})/?$ /index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/?$ /index.php?year=$1 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&tb=1 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&paged=$5 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/?([0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA,L]
    </IfModule>

    To view the phpinfo for my server go here: PHPinfo();

    Any ideas?

    -Ax

  2. An internal server error is something which happens internally, inside the server. As such, the actual error is written into your server error log. We need to know what that error is before making an appropriate suggestion.

  3. Axon
    Member
    Posted 9 years ago #

    I reveied my log files from the server, there is no error logged in the server logs.

    Any ideas?

    -Ax

  4. Recreate the 500 error and check your log again. The 500 error will not be displayed in your browser until after the actual error is written into the server error log, so it has to be there.

  5. Axon
    Member
    Posted 9 years ago #

    thats what my host said too! Unfortunitley I have been unable to have anything written to the error file!

    -Ax

  6. ceo
    Member
    Posted 9 years ago #

    I can't help with this specific problem till you find the error in the log, but I do know my host won't allow my .htaccess to be chmod'd to anything less secure than 644 - it caused HUGE problems when I tried to let WP write to it by setting it to 666...so, just saying, that could be the problem...but still seeing the error log will help to determine more certainly.

  7. jayhawksean
    Member
    Posted 9 years ago #

    i have the same situation as the original poster. i get the error when installing permalinks.

    unfortunately, i don't know how to get rid of the 500 internal error.

    i checked my error log and don't really have anything that looks like it could be what you'd need (i changed the IP addresses for posting just because i am paranoid):
    Error Logs
    [Wed Jun 29 10:40:27 2005] CURRENT SERVER TIME
    MAIN error_log:

    [Wed Jun 29 10:39:31 2005] [error] [client 69.34.91.139] File does not exist: /usr/local/apache/htdocs/favicon.ico
    [Wed Jun 29 10:40:01 2005] [error] [client 12.102.171.171] File does not exist: /usr/local/apache/htdocs/favicon.ico
    failed to open log file
    fopen: Permission denied
    ----------------------------------
    i think the errors listed are coming after the main error that should have occurred about 20 minutes prior to the times listed above.

    i had the same thing happen a few days ago and my hosting service (bluehost) sent me this email:
    The problem isn't with the server. It is with one of the rewrite directives in your .htaccess file. I renamed it to .htaccessold, and it works fine.
    -------------------

    i just used my FTP (transmit) to access my site. i see all of the files, but i fail to see the .htaccess file. and, even if i found it, i am not sure i'd be able to fix the rewrite directive.

    can someone help me understand how to find this .htaccess file? that might get me started with a fix. in the meantime, my whole site is down with the 500 internal error.

    TIA . . . bunches.

  8. jayhawksean
    Member
    Posted 9 years ago #

    actually, i just discovered that the 500 internal error is secondary. here's the message i get (and, i am the webmaster the message says to contact . . . the clueless webmaster, that is):

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, webmaster@nospamatticmooses.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

  9. jayhawksean
    Member
    Posted 9 years ago #

    I have found my .htaccess file by turning on invisible files. I have opened it in BBEdit and now that's where i am stuck. my webhost fixed this for me last time by editing one of the rewrite directives. how do i learn which directive is wrong and how to fix it?

    i do appreciate your patience as i try and overcome this error.

  10. jayhawksean
    Member
    Posted 9 years ago #

    this is my last post, but i figured i'd provide my .htaccess file that has the bad rewrite directive. can you point it out so that i can learn how to fix it next time? thank you.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [S=35]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /index.php?s=$1 [QSA,L]
    RewriteRule ^Structure: /category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^Structure: /category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^Structure: /category/(.+)/page/?([0-9]{1,})/?$ /index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^Structure: /category/(.+)/?$ /index.php?category_name=$1 [QSA,L]
    RewriteRule ^Structure: /author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^Structure: /author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^Structure: /author/([^/]+)/page/?([0-9]{1,})/?$ /index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^Structure: /author/([^/]+)/?$ /index.php?author_name=$1 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/?$ /index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/page/?([0-9]{1,})/?$ /index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/?$ /index.php?year=$1 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&tb=1 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&feed=$5 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&paged=$5 [QSA,L]
    RewriteRule ^Structure: /([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$ /index.php?year=$1&monthnum=$2&day=$3&name=$4&page=$5 [QSA,L]
    </IfModule>

    # END Word

  11. jayhawksean
    Member
    Posted 9 years ago #

    well, i just deleted the htaccess file and things returned to normal.

    i'd still like to add permalinks, but apparently, they don't like me.

    thanks for almost helping. ;~)

  12. vsa
    Member
    Posted 8 years ago #


  13. vsa
    Member
    Posted 8 years ago #

    I also have this .htaccess error/permalinks.
    Isn't there a solution!?

  14. TreoRenegade
    Member
    Posted 8 years ago #

    I don't know enough to give you a definitive answer, but I can share my troubleshooting technique when it comes to diagnosing htaccess-generated 500 errors.

    First, note that my wp area is within a subdirectory (/wp/). But this should still work for all. I use a /test/ directory, because it confines the errors to an area unused by anyone, except me while testing. Keep it directly off root, even if you have a /wp/ style subdirectory. Makes it easier to get to.

    1.) Create a special domain.com/test/ directory.
    2.) Insert a plain index.html file with the body containing only <h2>ok</h2>.
    3.) Copy your wp-related .htaccess to your harddrive's /test/ directory.
    3.) ftp to your server, create /test/ , and copy/transfer the .htaccess and index.html files to the directory you just created.

    Enter mydomain.com/test/ in your browser. If the OK shows, you know the .htaccess file is, at least, correct in its syntax. Syntax errors = what causes those 500 error messages. (Note: this assumes your server will automatically read domain.com/test/ as domain.com/test/index.html. If not, type in the whole thing in your address bar.)

    If you instead get the 500 error message, go back to the .htaccess file on your harddrive, and work thru it line by line. First go round, keep the condition lines but only one rewrite rule. Re-ftp. Call the /test/index.html file. If it shows, those few lines are ok. Go back, and add another rewrite line, test .. and so on down the lines of the .htaccess file. Sooner or later, after you ftp the file after adding a line, the error will occur. At that point, you know the exact line that's causing the problem. Comment out that line (stick a # at the beginning of the line) , add the next rewrite line, ftp, and test. Keep repeating this til you've worked your way thru the entire file. At the end, you'll have the offending line or lines. Once the precise problem line(s) is/are isolated, it's a heck of alot easier researching your way to a solution (webmasterworld.com ... Apache section is VERY good for this, although you likely will not find wordpress-specific solutions there).

    BTW, FWIW, I just compared my wp .htaccess to yours.

    1) I don't see that "Structure:" business anywhere. I'm referring to line 14 and all lines thereafter, treating the rewritebase line as #0.

    2) Further, there's no /category ... /author etc. (same lines #14 to end) at or near the start of my rewrite lines. Instead, it's ^category/ .... ^author/ ....

    Therefore, if I were confronted with your problem, I'd start by removing the "Structure: /" from each line in which it appears, ftp it to the /test/ area, and see if I get an ok. If so, then you've confirmed the offending lines. My permalinks work fine without that "structure: /" stuff, so I'd imagine yours would as well. But you'd then need to do one of 2 things: pinpoint what part of WP is causing those structure thingies to be inserted into the htaccess file; or, once you clean up that file, change permissions to turn off world-writable, so it can't be adversely affected again.

    =============
    To be clear, your line #14 begins:
    RewriteRule ^Structure: /category/(.+)/feed/

    Mine begins:
    RewriteRule ^category/(.+)/feed/

    Ditto re: the remaining rewrite lines.

    Example of a line turned-off, via commenting:
    # RewriteRule ^Structure: /category/(.+)/feed/

    =============

    I'm using the latest WP, 1.5.3 I think is the number. But I didn't see your "structure:" stuff in prior 1.5.2 either. Perhaps a plugin is causing this weirdness? You can check my list of active plugins to confirm that they play nice with others. http://law4pda.org/wp/plugins-used/ .

    Again, I am NOT an expert or guru. I just learn as I plod along ...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.