Setting up rewriting directly to virtual host as
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# handles landing page
RewriteRule ^/?$ index.php [L]
RewriteRule ^(.+)$ post.php?clean_url=$1 [L,QSA]
accessing the website http://192.168.1.120
leads to URL http://192.168.1.120/post.php?clean_url="index.php"
, which does not exist.
It seems that the first rule rewrites http://192.168.1.120
to http://192.168.1.120/index.php
, but it does not stop there; the second rule, in turn, leads to http://192.168.1.120/post.php?clean_url="index.php
. Why the second rule is involve here? I expect the first rewriting rule to be the L
ast in this case. Am I missing some rewriting concepts?
My apache version is
Server version: Apache/2.4.52 (Ubuntu)
Server built: 2022-06-14T12:30:21
As pointed out in this thread, reversing the order of those two rules fixed the problem