Good morning, I have a Virtual Host configured on an Apache2 server. The mod_rewrite module is active and functional.
I tested regular expressions on the site https://regex101.com/ and it behaves like I expect.
I tested the .htaccess file on the https://htaccess.madewithlove.be/ site and it works correctly.
I don't understand why, when I try it on the apache server it doesn't work.
Here is the complete .htaccess file
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(assets|locale)/(.*)$ user/$2/$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(/{0,1})user/([^/]+)(/?.*) user/$2.html [QSA,L]
Virtual host Configuration
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
Website structure
mywebsite.local
user/
- .htaccess
- index.html
- app.html
Tested URL
http://mywebsite.local/user/index/
http://mywebsite.local/user/app/
http://mywebsite.local/user/app/dashboard/
http://mywebsite.local/user/app/planningWeek/current/
http://mywebsite.local/user/app/task/taskId/day/month/year/
What I'm expected
http://mywebsite.local/user/index/
go to index.html (it works)
http://mywebsite.local/user/app/
go to app.html (it works)
http://mywebsite.local/user/app/dashboard/
it must go to app.html but I have this error
"The requested URL /user/app.html/dashboard was not found on this server."
I don't understand why the regular expression is valid and the .htaccess file from the sites indicated works, but if I load it on the server no.
Thanks