News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

HTTP 500 error in case no filename or parameter in URL

Started by Sono, October 06, 2023, 05:42:00 PM

Previous topic - Next topic

Sono

I got a strange error recently. I noticed from one moment to the other, my forum doesn't load, all pages return HTTP 500 error. I investigated that the error is present in case the filename and parameters are removed from the page urls. That is: if I type my sitename "Congovibes.com", I get error 500. But if I type 'Congovibes.com/index.php', the site loads. But only the main page. On all other pages, I get HTTP error 500 again, simply because I have Pretty URL mod ON, and it rewrites all URLS to miss the filename or parameters.

I managed to solve the issue by going to the maintenance page (where the URL is not rewritten), and deleted the Cache (Pretty URL is set to use cache not the database).

Things work again, but there is still something I worry about: recently I asked a technician to look into my forum because I had problems with too high bandwidth (200GB per month). He changed two things:

1. He used this modification to change querystring.php to avoid PHP SESSION ID for guests:
https://www.simplemachines.org/community/index.php?topic=410891.0

I see there you don't recommend this modification. So should I redo it?

2. He noticed that bots are very active on my forum, so he added some lines into .htaccess to stop them. This is my .htaccess now:

# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: July 16, 2022, 11:10

RewriteEngine on
RewriteBase /

#disable bad crawlers
RewriteCond %{HTTP_USER_AGENT} inetdex [NC,OR]
RewriteCond %{HTTP_USER_AGENT} MJ12bot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} SemrushBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} SentiBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} SeznamBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} YaK/ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} YandexBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} coccocbot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} bitlybot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Mail.Ru [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Baidu [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Jakarta [NC,OR]
RewriteCond %{HTTP_USER_AGENT} seostar.co [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Neticle [NC,OR]
RewriteCond %{HTTP_USER_AGENT} AhrefsBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} DotBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Bytespider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Sogou [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Exabot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} MauiBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ia_archiver [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Kinza [NC,OR]
RewriteCond %{HTTP_USER_AGENT} PetalBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} AspiegelBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Aspeigel [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Neevabot
RewriteRule ^.* - [F,L]

# Rules for: actions
RewriteRule ^(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(coppa|credits|deletemsg|display|dlattach|editpoll|editpoll2|emailuser)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(findmember|forum|portal|groups|help|helpadmin|hidetopic|im)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(jseditor|jsmodify|jsoption|lock|lockvoting|login|login2|logout)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(markasread|mergetopics|mlist|moderate|modifycat|modifykarma|movetopic|movetopic2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(notify|notifyboard|openidreturn|pm|post|post2|printpage|profile)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(quotefast|quickmod|quickmod2|recent|register|register2|reminder|removepoll)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(removetopic2|reporttm|requestmembers|restoretopic|search|search2|sendtopic|smstats)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(suggest|spellcheck|splittopics|stats|sticky|theme|trackip|about:mozilla)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(about:unknown|unread|unreadreplies|verificationcode|viewprofile|vote|viewquery|viewsmfile)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(who|\.xml|xmlhttp)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

# PRETTYURLS MOD ENDS

<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The next part below probably is not needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>

This was really useful because my bandwidth fell from 10GB per day to 1GB. However I am not sure the code was added correctly, as you see it was copied into the code of PrettyURL.

I wonder if any of these changes could result in the recent HTTP Error 500 problems in the cache?

What do you think?

Kindred

Yes,taking out the sesionid is BAD

As stated in that old thread,  if the site is erroring because of sessionid, then your HOST has misconfigured the server
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sono

Quote from: Kindred on October 06, 2023, 08:42:06 PMYes,taking out the sesionid is BAD

As stated in that old thread,  if the site is erroring because of sessionid, then your HOST has misconfigured the server

The Session ID was not removed because there were problems with the server. Just my technician concluded it makes no sense for guests. That's why he removed it. Probably thought it added to the bandwidth.

Kindred

It doesn't matter why it was removed, removing it is contraindicated...

And no, it didn't use up more the a few bytes of data bandwidth... and yes, it DOES make sense for guests.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: