: The presence of a .htaccess configuration causes a 500 error (even if it is blank) My htaccess file is giving my webpage a 500 error and I do not understand why ... this is the code:
My htaccess file is giving my webpage a 500 error and I do not understand why ...
this is the code:
AddHandler application/x-httpd-php56 .php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /gallery-page.php?galerie=
If I take the .htaccess file away, then I get 404 errors on the pages I needed renaming.
If I have the .htaccess file with no code in it, I still get an error 500.
If somebody can help me understand, it would be great !
More posts by @Candy875
2 Comments
Sorted by latest first Latest Oldest Best
I haven't scoped for AddHandler application/x-httpd-php56 .php but I stake the following on all of my websites:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Also, be sure to remove the HTTPS conditions if your site isn't SSL.
Your .htaccess syntax looks okay and running it through a validator confirms the syntax is fine. You can check your error log to see more information and see what is causing it but depending on your hosting environment (especially if it is a shared hosting server) you will probably find that the issue is the AddHandler application/x-httpd-php56 .php line. Many hosting providers prevent adding additional file handlers through .htaccess as it can cause security issues on the server. If your hosting provider does not already have PHP support on the server then simply adding that line to your .htaccess won't make it work and would produce a 500 error as there is no PHP installed on the server to process it, and if there is then the server will already be configured to handle PHP files and so there still would be no need to have that line added. Try removing that line and you should see it working.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.