Apache 2.4.56 MOD_REWRITE is not working for /cgi-bin/

Alles, was den Apache betrifft, kann hier besprochen werden.

Apache 2.4.56 MOD_REWRITE is not working for /cgi-bin/

Postby tmtmtm » 08. November 2023 16:37

1.) I have a question related to MOD_REWRITE / in file C:\xampp\htdocs\.htaccess.

It seems to work well in any directory except /cgi-bin/.

For example, when I try to switch from http:// to https:// by using the following RewriteRule:

Code: Select all
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.+)$ "https://%{HTTP_HOST}/$1" [R=301,L]


It won't switch to https:// for an URL like:
Code: Select all
http://localhost/cgi-bin/test.cgi


While it does this pretty well for an URL like:
Code: Select all
http://localhost/test.html


2.) Is there something wrong with my C:\xampp\apache\conf\httpd.conf?
Or do i need to place another .htaccess-File copy in the cgi-bin-Folder? In order to work correctly?
But when I try to do so, my webbrowser says that I dont have permission to access the CGI-scripts in /cgi-bin/ by telling me:

For example: URL:
Code: Select all
http://localhost/cgi-bin/Test1.cgi


Results in:

Code: Select all
"Forbidden
You don't have permission to access this resource."
Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.2.4 Server at localhost Port 80


Iam using Windows7 Pro with XAMPP.
Firefox Version 115.


I tried to copy the .htaccess-File from DocumentRoot / to /cgi-bin with result Error 403 Forbidden.

Thanks for your answers in advance.
tmtmtm
 
Posts: 3
Joined: 08. November 2023 16:32
XAMPP version: xampp-windows-x64-8.2.4-0-VS16
Operating System: Windows 7 Pro

Re: Apache 2.4.56 MOD_REWRITE is not working for /cgi-bin/

Postby tmtmtm » 08. November 2023 16:48

1.) Ich habe eine Frage bezogen auf MOD_REWRITE in Datei C:\xampp\htdocs\.htaccess.

Es scheint gut zu funktionieren in jedem URL-Verzeichnis ausser die URL enthält /cgi-bin/.

Zum Beispiel, wenn ich versuche von http:// auf https:// umzuschalten, durch folgende RewriteRule:

Code: Select all
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.+)$ "https://%{HTTP_HOST}/$1" [R=301,L]


Schaltet es nicht auf https:// für eine URL wie:
Code: Select all
http://localhost/cgi-bin/test.cgi


Während es das ziemlich gut macht für eine URL wie diese:
Code: Select all
http://localhost/test.html


2.) Stimmt da etwas mit meiner C:\xampp\apache\conf\httpd.conf nicht?
Oder muss ich noch eine .htaccess-Kopie in cgi-bin ablegen? Wenn ich das so tue, sagt mir mein Webbrowser aber dass ich nicht die Berechtigung
habe um auf meine CGI-Skripte zuzugreifen.

Zum Beispiel: URL:
Code: Select all
http://localhost/cgi-bin/Test1.cgi


Ergibt folgendes::

Code: Select all
"Forbidden
You don't have permission to access this resource."
Apache/2.4.56 (Win64) OpenSSL/1.1.1t PHP/8.2.4 Server at localhost Port 80


Ich benutze Windows7 Pro mit XAMPP.
Firefox Version 115.


Ich versuchte die .htaccess-Datei von der DocumentRoot / nach /cgi-bin zu kopieren, mit dem Ergebnis Error 403 Forbidden.

Danke für eure Antworten im Voraus.
tmtmtm
 
Posts: 3
Joined: 08. November 2023 16:32
XAMPP version: xampp-windows-x64-8.2.4-0-VS16
Operating System: Windows 7 Pro

Re: Apache 2.4.56 MOD_REWRITE is not working for /cgi-bin/

Postby tmtmtm » 16. November 2023 19:59

C:\xampp\apache\conf\httpd.conf:
Antwort: "Vielleicht hat die Skript-Alias-Anweisung für /cgi-bin Vorrang vor dem Umschreiben? Entfernen Sie den Skript-Alias ​​für die http-Site und prüfen Sie, ob dies besser ist."

Es macht mir damit zwar https:// - Umleitungen, aber es kommt ein Umleitungsfehler.

Code: Select all
Fehler: Umleitungsfehler

Beim Verbinden mit localhost trat ein Fehler auf.

    Dieses Problem kann manchmal auftreten, wenn Cookies deaktiviert oder abgelehnt werden.


...aus Firefox 115.
tmtmtm
 
Posts: 3
Joined: 08. November 2023 16:32
XAMPP version: xampp-windows-x64-8.2.4-0-VS16
Operating System: Windows 7 Pro

Re: Apache 2.4.56 MOD_REWRITE is not working for /cgi-bin/

Postby Nobbie » 17. November 2023 00:18

Was steht im error log, was steht im access log? Und wie sieht die Apache Konfiguration für https aus (Inhalt des VirtualHost), gibt es weitere VirtualHosts?
Nobbie
 
Posts: 13176
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 111 guests