I noticed an odd (to me) mod_rewrite
thing happening. Fixing it is not important to me so much as figuring out what's going on. Basically, I have an svg file called test.svg
in my document root, as well as an index.php
. My expectation, based on my .htaccess
file is that visiting http://localhost/test.svg
would get me the .svg
file (and it does), while visiting http://localhost/test/action
would be rewritten to index.php/test/action
. Instead, the latter is apparently rewritten to test.svg/action
, as I receive the message
The requested URL /test.svg/action was not found on this server.
Here is my .htaccess
file:
# Turn on URL rewriting
RewriteEngine On
# Protect application and system files from being viewed
# RewriteRule ^(application|modules|system) - [F,L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT,L]
I am using a Apache 2.2.12 on Ubuntu (installed via apt-get
). I think my setup is fairly standard, but I'm not sure exactly what directives or config files would be relevant. I am by no means a sysadmin of any kind, I just use this server to test and develop things locally.
As I said, fixing this issue would be trivial, I just am often confounded by mod_rewrite
and would like to understand what's going on here.