While working on your website, you may be redirected to the InfinityFree 500 error page. This article explains why this typically happens and what you can do to fix this.
Bad .htaccess rules
The most common reason why you may be redirected to this page is because of an error in your .htaccess file.
.htaccess rules are quite sensitive to errors. And when they break, servers are not very clear about what the issue is.
The first thing to try is to rename the .htaccess file to something else (e.g. .htaccess.bak) and try to access the page again. Do you see something other than the 500 error page? If so, then it’s definitely the .htaccess rules which are invalid.
Tips for fixing bad .htaccess rules
Fixing .htaccess rules is tricky. .htaccess rules don’t show any clear error messages indicating which lines broke down.
However, there are some tricks you can try to identify the broken lines.
After recent changes to .htaccess rules
Did you make any recent changes to your .htaccess file? If so, those may be the cause of the issue. You can try reverting them or turning the lines into comments by adding a
# at the start of the line.
After you’ve done this, you can try to open the page again to see if this changed anything.
Disabling blocks of .htaccess rules
Sometimes, .htaccess files can contain many rules from different sources. If so, it’s useful to narrow down which part of the code is causing the issue.
Generally, .htaccess rules contain different “blocks” of rules related to different functionality. To identify whether a certain block is broken, you can remove it or turn it into comment (by adding a
# to the start of every line). Be sure to comment out the entire block - incomplete .htaccess code snippets by themselves can cause the server to crash too.
There are a few different blocks to identify.
Some .htaccess files contain blocks with start with
<...> and end with
<!...>. These blocks are used to apply code conditionally.
For example, the code below applies URL rewrite rules only if the mod_rewrite module is installed:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule . /index.php </IfModule>
These blocks can be disabled entirely. A block start (
<...>) without a block end (
<!...>) will break too.
RewriteRule and RewriteCond
The most common use case for .htaccess rules are to rewrite URLs. This is done primarily with the lines starting with
It’s important to understand that the
RewriteCond directives apply to the first
RewriteRule statement that follows. So when checking whether any of these rules are invalid, please make sure you’re disabling any applicable RewriteCond statements when you’re disabling RewriteRule statements, or the .htaccess file will be invalid too.
The statements starting with
Options are always standalone. You can disable these rules individually safely.
Make sure you’ve copied the rules correctly
If you’ve copied the rules from a document or web page, please make sure you’ve copied the rules completely and correctly. .htaccess rules are very sensitive to typos, whitespace characters and line endings. If you make any errors here while copying code or typing them, it can cause the server to crash.
Also try to view the .htaccess file through our web based file manager, not just your local editor. Different operating systems use different ways to designate line endings, and what looks OK on your own computer may look completely different on the server.
You should also be careful when using translation tools. Web page translation systems may mangle any code snippets being displayed on the page, or try to translate keywords in the code itself. Please disable your translator before copying the snippet to make sure you are actually copying the snippet as it was written by the publisher.
Try a different example
If you’ve copied an example from the internet to do something, it may be that the example had errors or just doesn’t work on InfinityFree. If so, you can continue the search for different examples to try instead.
A PHP error
Another reason you may see a 500 error is because of an error in your PHP code. However, if this happens, you’ll usually see the HTTP ERROR 500 page from your browser. Please see the article about that error for more information on how to deal with such errors.