Author Topic: 500 internal server error rewrite  (Read 3236 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
500 internal server error rewrite
« on: January 23, 2022, 06:02:00 PM »
Hi
Rewrite in my .htaccess file gives 500 internal server error. can you help me please.
.htaccess codes
Code: [Select]
<IfModule mod_rewrite.c>

    Options +FollowSymLinks
    RewriteEngine on

    # Send request via index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>

</IfModule>

Offline
***
Re: 500 internal server error rewrite
« Reply #1 on: January 23, 2022, 06:53:13 PM »
Do this instead:
Code: [Select]
Options +FollowSymLinks
<IfModule mod_rewrite.c>
   RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www\.EXAMPLE\.TLD[NC]
    RewriteRule ^(.*)$ http://EXAMPLE.TLD/$1 [L,R=301,NC]
    # Send request via index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
Change EXAMPLE and TLD to your domain name.

Also check the domlogs to see what's actually wrong. The logs will say which line is giving error 500:
Code: [Select]
tail -f /usr/local/apache/domlogs/YourDomain
« Last Edit: January 23, 2022, 06:56:58 PM by iraqiboy90 »

Offline
*
Re: 500 internal server error rewrite
« Reply #2 on: January 23, 2022, 08:50:36 PM »
my daily error codes
 Options FollowSymLinks not allowed
I did some research but it's very complicated. What should I do with an example?

Offline
***
Re: 500 internal server error rewrite
« Reply #3 on: January 23, 2022, 11:15:36 PM »
my daily error codes
 Options FollowSymLinks not allowed
I did some research but it's very complicated. What should I do with an example?

It's not complicated at all. Remove this line:
Code: [Select]
Options +FollowSymLinksor change it to:
Code: [Select]
Options +SymLinksIfOwnerMatch
I'm wondering why you are even using this, as it is potentially a security issue. SymLinksIfOwnerMatch is better for security.
The reason for getting this error is because the apache template you are using does not let you control the "Options" variable for "FollowSymLinks" because it's not defined in there that you are allowed to:
Code: [Select]
<Directory "%docroot%">
Options -Indexes -FollowSymLinks +SymLinksIfOwnerMatch
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
« Last Edit: January 23, 2022, 11:25:32 PM by iraqiboy90 »

Offline
*
Re: 500 internal server error rewrite
« Reply #4 on: January 25, 2022, 08:10:43 PM »
Options +SymLinksIfOwnerMatch this code worked for me but gave sql error.
The sql file cannot be dumped with the user added in mysql.
but if we select the user as root, it loads and works.

Offline
***
Re: 500 internal server error rewrite
« Reply #5 on: January 25, 2022, 09:06:26 PM »
Options +SymLinksIfOwnerMatch this code worked for me but gave sql error.
The sql file cannot be dumped with the user added in mysql.
but if we select the user as root, it loads and works.
Ok, then remove it as well:
Code: [Select]
Options +SymLinksIfOwnerMatch
Do you want/need it?