http://localhost/frontend_dev.php/1
Why is the above request redirected to frontend_dev.php
instead of index.php
?
I've read the .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
If I'm understanding it correctly,if the requested file doesn't exist,it should be redirected to index.php
,how can frontend_dev.php
be run in the case above?
You have specified http://localhost/frontend_dev.php/1 as the URL - Apache simply serves up frontend_dev.php
as you are explicitly asking for that file in the URL. Change your URL to http://localhost/index.php/1 to see the production controller.
The rewrite rules deal only with URLs that don't mention a front controller at all, ie. http://localhost/1 - the rewrite rules are not being parsed at all for the URL you initially provided, as Apache detected the frontend_dev.php file and found no matching rewrite rule to parse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With