File structuur:
htdocs/mvcstruct/
- app/
- public/
- | css/
- | img/
- | js/
- |.htacces
- |index.php
Inhoud .htaccess:
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
RewriteBase /mvcstruct/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>
Request URL: http://localhost:3000/mvcstruct/
Output:
Index of /mvcstruct
Parent Directory
app/
public/
OK, dat is volgens verwachting.
Request URL: http://localhost:3000/mvcstruct/public/
Output:
Hello World
OK, dat staat in index.php, prima.
Request URL: http://localhost:3000/mvcstruct/public/test.php
Output:
Not Found
The requested URL /mvcstruct/public/test.php was not found on this server.
Dit verwacht ik niet, wat doe ik verkeerd?
De file test.php zit niet in de map public; ik verwacht uitvoering van de RewriteRule en derhalve uitvoeren van index.php.
Wat doe ik verkeerd cq onvoldoende dan wel te veel?
3.864 views