I am currently developing a mini framework which uses a htaccess doc which redirects all traffic from the public folder to another folder. But Ive realized that it also redirects all direct links to images, css and scripts.
I am not that familiar with htaccess code, how can I put those exceptions in this htaccess code
RewriteEngine on
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?cmd=$1 [PT,L]
Thanks in advance
You cannot route everything to public/
and index.php
at the same time. You probably want this rule in your DocumentRoot/.htaccess
:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]