[VYŘEŠENO] RewriteRule způsobuje HTTP 400 chybu, co s ní?

theacastus
Člen | 81
+
0
-

Zdravím,

requiremets checker mi hlásí že mod_rewrite je OK. Ale…

http://htaccess.mwl.be?…

zde je moje konfigurace mod_rewrite:

RewriteEngine On
# RewriteBase /
# prevents files starting with dot to be viewed by browser
RewriteRule /\.|^\.(?!well-known/) - [F]

# front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz|map|xlsx)$ index.php [L]

Vše ostatní na vhostu funguje jak má, ničím jiným to není. Když použiju toto nastavení, server mi vrací
HTTP/1.1 400, takže bad request.
Podle toho checkeru na mod_rewrite je chyba v L parametru v RewriteRule.

V error logu nic není, pouze v access logu mám info o tom že byl poslán GET požadavek.

Web server (VPS):
Debian 8, 64bit
Apache 2.4.10
PHP 7.0.20
MySQL 5.5.54

Za všechny rady jsem moc vděčný

Editoval theacastus (21. 6. 2017 17:24)

Martk
Člen | 655
+
0
-

Zkus odkomentovat řádek

# RewriteBase /
theacastus
Člen | 81
+
0
-

Tak vyřešeno…

Musel jsem přidat k RewriteRule před index.php /, tj. /index.php

Pokud by to někdo někdy hledal,

v tuto chvíli je funkční:

<IfModule mod_rewrite.c>
		RewriteEngine On
		#RewriteBase /

		# prevents files starting with dot to be viewed by browser
		RewriteRule /\.|^\.(?!well-known/) - [F]

		# front controller
		RewriteCond %{REQUEST_FILENAME} !-f
		RewriteCond %{REQUEST_FILENAME} !-d
		RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz|map|xlsx|ttf|woff|woff2|svg)$ /index.php [L]
	</IfModule>

Když zapnu RewriteBase, netuším proč, hodí to tuto chybu:

RewriteBase: only valid in per-directory config files

Editoval theacastus (21. 6. 2017 17:01)