Is my Apache local install wrong or is yours wrong ?
Opened this issue · 0 comments
Describe the bug
The first slash behaviour is different on my local Linux machine with a local Apache install.
For confidentially purposes I've made up a similar request which you can test using the link at the bottom, but it boils down to the fact that this rule :
RewriteCond %{HTTP_HOST} ^(www\.)?blabla\.com$ [NC]
RewriteRule ^(.*)/hello/([^/]+)/city\.([^/]+)$ /greetings/$2/hometown.$3 [R=301,L]
Doesn't trigger on https://www.blabla.com/hello/dennis/city.terneuzen
While this rule does :
RewriteCond %{HTTP_HOST} ^(www\.)?blabla\.com$ [NC]
RewriteRule ^(.*)hello/([^/]+)/city\.([^/]+)$ /greetings/$2/hometown.$3 [R=301,L]
A coworker told me this is due to the fact that the first slash is implicit in a RewriteRule.
However.. when I run it locally like so the initial slash is not a problem :
Even so, when I remove the / in my conf file, it becomes too lenient and even something like https://www.blabla.com/justsayhello/mike/city.chicago is accepted, which of course should not be the case :
Version of local Apache :
Expected behavior
I expect a local install of apache2 to act the same as this htaccess.madewithlove.com.
Reproduce link
https://htaccess.madewithlove.com?share=f23bf153-4c15-422e-b9d2-92c680ffb21b
second link where I changed the rule by remove the first slash : https://htaccess.madewithlove.com?share=5ab39841-432c-4eb3-a430-200aab12b283 Note that you can just use anything that ends in "hello" for the first part...