htaccess may cause 500 error.

Status
Not open for further replies.

janokchen

New Member
Messages
2
Reaction score
0
Points
0
before i added a .htaccess file, i could visit my site.

then i even could not open the index page while it appeared 500 error.

as admin of x10hosting said, i changed the files from 0644 to 0755. but it didn't work.

later i removed the .htaccess file, and it turned to index page right now. Great.

my site : http://www.beijingcheaphotels.org/

my .htaccess content:

AddType application/x-httpd-php .html .htm
php_value default_charset utf-8

may my experience will be helpful for who are suffering 500 errors.
 

bhupendra2895

New Member
Messages
554
Reaction score
20
Points
0
Hi, have look at this quote, it is picked from http://corz.org/serv/tricks/htaccess.php
If you add something that the server doesn't understand or support, you will get a 500 error page, aka.. "the server did a boo-boo". Even directives that work perfectly on your test server at home may fail dramatically at your real site. In fact this is a great way to find out if .htaccess files are enabled on your site; create one, put some gibberish in it, and load a page in that folder, wait for the 500 error. if there isn't one, probably they are not enabled.

If they are, we need a way to safely do live-testing without bringing the whole site to a 500 standstill.

Fortunately, in much the same way as we used the <Limit> tag above, we can create conditional directives, things which will only come into effect if certain conditions are true. The most useful of these is the "ifModule" condition, which goes something like this..

only if PHP is loaded, will this directive have any effect (switch the 4 for a 5 if using php5)
<ifModule mod_php4.c>
php_value default_charset utf-8
</ifModule>


..which placed in your master .htaccess file, that would set the default character encoding of your entire site to utf-8 (a good idea!), at least, anything output by PHP. If the PHP4** module isn't running on the server, the above .htaccess directive will do exactly nothing; Apache just ignores it. As well as proofing us against knocking the server into 500 mode, this also makes our .htaccess directives that wee bit more portable. Of course, if your syntax is messed-up, no amount of if-module-ing is going to prevent a error of some kind, all the more reason to practice this stuff on a local test server.
This is a programming problem and can be resolved using the method mentioned above.
 

Jarryd

Community Advocate
Community Support
Messages
5,534
Reaction score
43
Points
48
Hello,

As we have not received any replies i am marking this ticket as resolved. If you have any further issues please re-open this ticket or create a new one.
 
Status
Not open for further replies.
Top