I'm using the following rewrite url to get prettier urls:
RewriteRule (\d+)/(.+) $2?companyId=$1 [NC,L,B,QSA,NE]
/invoices.php?companyId=123 can for example be expressed as
/123/invoices.php. I tested and it works fine.
js/jquery.js. I thought that these files would also be covered by my rewrite url which is pretty generic, but apparently it doesn't and returns a 404 instead.
/123/js/jquery.js in the browser returns a 404 error:
The requested URL /js/jquery.js was not found on this server. Note how the error message refers to the file name which has been rewritten to the correct file name. If i copy-paste the url from the error message into my browser's url field (ommiting the rewrite rule) it returns the file!
Putting my php file in the
/test sub folder yields the very same issue, example:
The requested URL /test/invoices.php was not found on this server.
Again, mod_rewrite has changed the path as expected but apache fails to find the file. Accessing it directly works fine.
Does anyone know why apache cannot find files in subdirectories when the path has been through the rewrite module?