Error 500 htaccess  [SOLVED]

Have you discovered a bug? Tell us about it.
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

Error 500 htaccess

Post by PuntonetSvb »

Tengo el siguiente htacces

Code: Select all

Options All -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteRule seccion-(.*)-(.*)\.htm$ seccion.php?sec=$1&id=$2
RewriteRule otras-(.*)\.htm$ otras.php?id=$1
RewriteRule ver-(.*)-(.*)\.htm$ vercliente.php?nombre=$1&id=$2
RewriteRule enviarmensaje-(.*)-(.*)\.htm$ enviarmensaje.php?nombre=$1&id=$2
RewriteRule enviaroferta-(.*)-(.*)\.htm$ enviaroferta.php?nombre=$1&id=$2
RewriteRule veroferta-(.*)\.htm$ veroferta.php?idoferta=$1
RewriteRule verquehacer-(.*)\.htm$ verquehacer.php?id=$1
RewriteRule verrutamotor-(.*)\.htm$ verrutamotor.php?id=$1
RewriteRule verrutapie-(.*)\.htm$ verrutapie.php?id=$1
RewriteRule verquever-(.*)-(.*)\.html$ verquever.php?n=$1&id=$2
RewriteRule fiesta-(.*)-(.*)\.html$ fiesta.php?nombre=$1&fiesta=$2
y me tira el siguiente error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@domain.tld to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Al mirar el log veo lo siguiente:
/home/users/usuario/www/.htaccess: Option FollowSymLinks not allowed here, referer: https://domain.tld/
Estaba funcionando perfectamente en i-mscp hasta ayer.

Mod edit: Added code tags
User avatar
24unix
Posts: 1560
Joined: Sun 21. Jun 2020, 17:16
Location: Kollmar
Contact:

Re: Error 500 htaccess

Post by 24unix »

You need to supply the contents of

Code: Select all

/home/users/usuario/logs/error.log
I guess you speak Spanish, could you provide a description in English?
mfg Micha
--
If Bill Gates had a nickel for every time Windows crashed …
… oh wait, he does.
tab-kh
Posts: 450
Joined: Thu 22. Apr 2021, 23:06

Re: Error 500 htaccess

Post by tab-kh »

You might try to use "SymlinksIfOwnerMatch" instead of "FollowSymLinks". The latter is disallowed by default in Keyhelp because of security reasons. So using it in .htaccess will throw an Internal Server Error/Error 500.
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

My error.log file

Post by PuntonetSvb »

Code: Select all

[Sat Sep 10 10:00:34.335553 2022] [core:alert] [pid 305573:tid 140350662403840] [client 91.126.41.116:65270] /home/users/sajanansa/www/.htaccess: Option All not allowed here
 
[Sat Sep 10 10:00:35.772396 2022] [core:alert] [pid 305573:tid 140350662403840] [client 91.126.41.116:65270] /home/users/sajanansa/www/.htaccess: Option All not allowed here

MY HTACCESS MODIFIED

Code: Select all

Options All -Indexes
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteBase /
RewriteRule seccion-(.*)-(.*)\.htm$ seccion.php?sec=$1&id=$2
RewriteRule otras-(.*)\.htm$ otras.php?id=$1
RewriteRule ver-(.*)-(.*)\.htm$ vercliente.php?nombre=$1&id=$2
RewriteRule enviarmensaje-(.*)-(.*)\.htm$ enviarmensaje.php?nombre=$1&id=$2
RewriteRule enviaroferta-(.*)-(.*)\.htm$ enviaroferta.php?nombre=$1&id=$2
RewriteRule veroferta-(.*)\.htm$ veroferta.php?idoferta=$1
RewriteRule verquehacer-(.*)\.htm$ verquehacer.php?id=$1
RewriteRule verrutamotor-(.*)\.htm$ verrutamotor.php?id=$1
RewriteRule verrutapie-(.*)\.htm$ verrutapie.php?id=$1
RewriteRule verquever-(.*)-(.*)\.html$ verquever.php?n=$1&id=$2
RewriteRule fiesta-(.*)-(.*)\.html$ fiesta.php?nombre=$1&fiesta=$2
But is the same error

Mod edit: Added code tags
User avatar
24unix
Posts: 1560
Joined: Sun 21. Jun 2020, 17:16
Location: Kollmar
Contact:

Re: My error.log file

Post by 24unix »

PuntonetSvb wrote: Sat 10. Sep 2022, 12:01 [Sat Sep 10 10:00:34.335553 2022] [core:alert] [pid 305573:tid 140350662403840] [client 91.126.41.116:65270] /home/users/sajanansa/www/.htaccess: Option All not allowed here
[Sat Sep 10 10:00:35.772396 2022] [core:alert] [pid 305573:tid 140350662403840] [client 91.126.41.116:65270] /home/users/sajanansa/www/.htaccess: Option All not allowed here

But is the same error
You still have Option All in the htaccess.
mfg Micha
--
If Bill Gates had a nickel for every time Windows crashed …
… oh wait, he does.
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

Re: Error 500 htaccess

Post by PuntonetSvb »

If I remove the line
Options All-Indexes
It doesn't give me the 500 error, but it doesn't apply the rewrite rules below either.
User avatar
24unix
Posts: 1560
Joined: Sun 21. Jun 2020, 17:16
Location: Kollmar
Contact:

Re: Error 500 htaccess

Post by 24unix »

PuntonetSvb wrote: Sat 10. Sep 2022, 12:20 If I remove the line
Options All-Indexes
It doesn't give me the 500 error, but it doesn't apply the rewrite rules below either.
I just checked a phpBB running on KeyHelp, rewrite is working, no Options are set.

Did you enable mod_rewrite?

Here it is:

Code: Select all

# apache2ctl -M|grep rewrite
 rewrite_module (shared)
else:

Code: Select all

a2enmod rewrite
mfg Micha
--
If Bill Gates had a nickel for every time Windows crashed …
… oh wait, he does.
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

Re: Error 500 htaccess

Post by PuntonetSvb »

I do it but the error is the same
whit this htaccess

Code: Select all

Options All -Indexes
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteRule seccion-(.*)-(.*)\.htm$ seccion.php?sec=$1&id=$2
RewriteRule otras-(.*)\.htm$ otras.php?id=$1
RewriteRule ver-(.*)-(.*)\.htm$ vercliente.php?nombre=$1&id=$2
RewriteRule enviarmensaje-(.*)-(.*)\.htm$ enviarmensaje.php?nombre=$1&id=$2
RewriteRule enviaroferta-(.*)-(.*)\.htm$ enviaroferta.php?nombre=$1&id=$2
RewriteRule veroferta-(.*)\.htm$ veroferta.php?idoferta=$1
RewriteRule verquehacer-(.*)\.htm$ verquehacer.php?id=$1
RewriteRule verrutamotor-(.*)\.htm$ verrutamotor.php?id=$1
RewriteRule verrutapie-(.*)\.htm$ verrutapie.php?id=$1
RewriteRule verquever-(.*)-(.*)\.html$ verquever.php?n=$1&id=$2
RewriteRule fiesta-(.*)-(.*)\.html$ fiesta.php?nombre=$1&fiesta=$2
error 500

with this htaccess

Code: Select all

Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteRule seccion-(.*)-(.*)\.htm$ seccion.php?sec=$1&id=$2
RewriteRule otras-(.*)\.htm$ otras.php?id=$1
RewriteRule ver-(.*)-(.*)\.htm$ vercliente.php?nombre=$1&id=$2
RewriteRule enviarmensaje-(.*)-(.*)\.htm$ enviarmensaje.php?nombre=$1&id=$2
RewriteRule enviaroferta-(.*)-(.*)\.htm$ enviaroferta.php?nombre=$1&id=$2
RewriteRule veroferta-(.*)\.htm$ veroferta.php?idoferta=$1
RewriteRule verquehacer-(.*)\.htm$ verquehacer.php?id=$1
RewriteRule verrutamotor-(.*)\.htm$ verrutamotor.php?id=$1
RewriteRule verrutapie-(.*)\.htm$ verrutapie.php?id=$1
RewriteRule verquever-(.*)-(.*)\.html$ verquever.php?n=$1&id=$2
RewriteRule fiesta-(.*)-(.*)\.html$ fiesta.php?nombre=$1&fiesta=$2
Not error 500 but error 404 when rewrite

Mod edit: Added code tags
User avatar
24unix
Posts: 1560
Joined: Sun 21. Jun 2020, 17:16
Location: Kollmar
Contact:

Re: Error 500 htaccess

Post by 24unix »

You have not a single rewrite condition.
mfg Micha
--
If Bill Gates had a nickel for every time Windows crashed …
… oh wait, he does.
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

Re: Error 500 htaccess

Post by PuntonetSvb »

Code: Select all

RewriteRule seccion-(.*)-(.*)\.htm$ seccion.php?sec=$1&id=$2
RewriteRule otras-(.*)\.htm$ otras.php?id=$1
RewriteRule ver-(.*)-(.*)\.htm$ vercliente.php?nombre=$1&id=$2
RewriteRule enviarmensaje-(.*)-(.*)\.htm$ enviarmensaje.php?nombre=$1&id=$2
RewriteRule enviaroferta-(.*)-(.*)\.htm$ enviaroferta.php?nombre=$1&id=$2
RewriteRule veroferta-(.*)\.htm$ veroferta.php?idoferta=$1
RewriteRule verquehacer-(.*)\.htm$ verquehacer.php?id=$1
RewriteRule verrutamotor-(.*)\.htm$ verrutamotor.php?id=$1
RewriteRule verrutapie-(.*)\.htm$ verrutapie.php?id=$1
RewriteRule verquever-(.*)-(.*)\.html$ verquever.php?n=$1&id=$2
RewriteRule fiesta-(.*)-(.*)\.html$ fiesta.php?nombre=$1&fiesta=$2
Mod edit: Added code tags
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Error 500 htaccess  [SOLVED]

Post by Alexander »

I have tested it with

.htaccess

Code: Select all

Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteRule seccion-(.*)-(.*)\.htm$ seccion.php?sec=$1&id=$2
RewriteRule otras-(.*)\.htm$ otras.php?id=$1
RewriteRule ver-(.*)-(.*)\.htm$ vercliente.php?nombre=$1&id=$2
RewriteRule enviarmensaje-(.*)-(.*)\.htm$ enviarmensaje.php?nombre=$1&id=$2
RewriteRule enviaroferta-(.*)-(.*)\.htm$ enviaroferta.php?nombre=$1&id=$2
RewriteRule veroferta-(.*)\.htm$ veroferta.php?idoferta=$1
RewriteRule verquehacer-(.*)\.htm$ verquehacer.php?id=$1
RewriteRule verrutamotor-(.*)\.htm$ verrutamotor.php?id=$1
RewriteRule verrutapie-(.*)\.htm$ verrutapie.php?id=$1
RewriteRule verquever-(.*)-(.*)\.html$ verquever.php?n=$1&id=$2
RewriteRule fiesta-(.*)-(.*)\.html$ fiesta.php?nombre=$1&fiesta=$2
Than created a seccion.php file with the content

Code: Select all

<?php
echo "This is seccion.php\n\n";
var_dump($_SERVER);

Than called http://mydomain.com/seccion-11-22.htm

And correctly received this (see QUERY_STRING for example):

Code: Select all

This is seccion.php

array(40) {
  ["TEMP"]=>
  string(21) "/home/users/test/tmp/"
  ["TMPDIR"]=>
  string(21) "/home/users/test/tmp/"
  ["TMP"]=>
  string(21) "/home/users/test/tmp/"
  ["USER"]=>
  string(4) "test"
  ["HOME"]=>
  string(17) "/home/users/test/"
  ["SCRIPT_NAME"]=>
  string(12) "/seccion.php"
  ["REQUEST_URI"]=>
  string(18) "/seccion-11-22.htm"
  ["QUERY_STRING"]=>
  string(12) "sec=11&id=22"
  ["REQUEST_METHOD"]=>
  string(3) "GET"
  ["SERVER_PROTOCOL"]=>
  string(8) "HTTP/1.1"
  ["GATEWAY_INTERFACE"]=>
  string(7) "CGI/1.1"
  ["REDIRECT_QUERY_STRING"]=>
  string(12) "sec=11&id=22"
  ["REDIRECT_URL"]=>
  string(18) "/seccion-11-22.htm"
  ["REMOTE_PORT"]=>
  string(5) "47988"
  ["SCRIPT_FILENAME"]=>
  string(32) "/home/users/test/www/seccion.php"
  ["SERVER_ADMIN"]=>
  string(34) "..."
  ["CONTEXT_DOCUMENT_ROOT"]=>
  string(21) "/home/users/test/www/"
  ["CONTEXT_PREFIX"]=>
  string(0) ""
  ["REQUEST_SCHEME"]=>
  string(4) "http"
  ["DOCUMENT_ROOT"]=>
  string(21) "/home/users/test/www/"
  ["REMOTE_ADDR"]=>
  string(12) "..."
  ["SERVER_PORT"]=>
  string(2) "80"
  ["SERVER_ADDR"]=>
  string(12) "..."
  ["SERVER_NAME"]=>
  string(24) "..."
  ["SERVER_SOFTWARE"]=>
  string(6) "Apache"
  ["SERVER_SIGNATURE"]=>
  string(0) ""
  ["PATH"]=>
  string(70) "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
  ["HTTP_ACCEPT_LANGUAGE"]=>
  string(45) "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7,und;q=0.6"
  ["HTTP_ACCEPT_ENCODING"]=>
  string(13) "gzip, deflate"
  ["HTTP_ACCEPT"]=>
  string(135) "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
  ["HTTP_USER_AGENT"]=>
  string(101) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
  ["HTTP_UPGRADE_INSECURE_REQUESTS"]=>
  string(1) "1"
  ["HTTP_CACHE_CONTROL"]=>
  string(9) "max-age=0"
  ["HTTP_CONNECTION"]=>
  string(10) "keep-alive"
  ["HTTP_HOST"]=>
  string(24) "..."
  ["REDIRECT_STATUS"]=>
  string(3) "200"
  ["FCGI_ROLE"]=>
  string(9) "RESPONDER"
  ["PHP_SELF"]=>
  string(12) "/seccion.php"
  ["REQUEST_TIME_FLOAT"]=>
  float(1662982549.497864)
  ["REQUEST_TIME"]=>
  int(1662982549)
}

So everything works as expected.
If it does not on your server, there maybe is something which interfere this process.

Default KeyHelp configurations are fine as you can see above and therefor this is not related to KeyHelp.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

Re: Error 500 htaccess

Post by PuntonetSvb »

I generate an htaccess from this website, to test
https://www.generateit.net/mod-rewrite/index.php
and it generates the following code:

RewriteEngine on
RewriteRule ver-(.*)\.htm$ page.php?id=$1
I add the line that you indicated before
Options +SymLinksIfOwnerMatch
and the result is the same, if I write: midominio.com/pagina=closures it works correctly, but if I call the web: midominio.com/ver-closures.htm, I get a 404
2022-10-10 13:57:58 xx.xx.xx.xx 404 GET /view-enclosures.html HTTP/2.0

Could someone help me to generate a working htaccess in keyhelp with which I can do a modrewrite of:
see-idpage.htm and go to page.php?id=idpage
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Error 500 htaccess

Post by Alexander »

The "page.php" file exists in the same directory?


This is just a typo (?):

RewriteRule ver-(.*)\.htm$ page.php?id=$1
or
midominio.com/ver-closures.htm

vs

2022-10-10 13:57:58 xx.xx.xx.xx 404 GET /view-enclosures.html HTTP/2.0
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
PuntonetSvb
Posts: 33
Joined: Thu 7. Apr 2022, 19:16

Re: Error 500 htaccess

Post by PuntonetSvb »

the same way, 404 error
404 GET /ver-cerramientos.html HTTP/2.0
User avatar
Tobi
Community Moderator
Posts: 2812
Joined: Thu 5. Jan 2017, 13:24

Re: Error 500 htaccess

Post by Tobi »

PuntonetSvb wrote: Mon 10. Oct 2022, 14:04 RewriteRule ver-(.*)\.htm$ page.php?id=$1
Your rewrite rule is meant for „htm“ files.
But you are trying to load a „html“ file.
Gruß,
Tobi


-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
Post Reply