Mod_rewrite problem on Apache 2
I'm running into a modrewrite problem of the type 'it works on Windows but not on Ubuntu Hardy Linux'. I also cannot seem to be able to activate logging for modrewrite so it's really hard to debug the issue.
I have a directory /assets/54/images/sprite.png that needs to be rewritten to the internal directory /assets/images/sprite.png
I have a virtual host assets.mysite.com and I'm currently using .htaccess to block access to the demo site.
This is my code for mod_rewrite
NameVirtualHost *:80
<virtualhost *:80="">ServerName assets.mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /usr/share/apache-tomcat-6.0.24/webapps/ROOT/
<directory>Options FollowSymLinks
AllowOverride None</directory>
<directory usr="" share="" apache-tomcat-6.0.24="" webapps="" root="">Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteCond %{REQUEST_URI} assets/.*
RewriteRule ^.*assets/([^/]+)/(.*)$ /assets/$2</ifmodule></directory>
[...]</virtualhost>
When I request /assets/10/ I correctly see a directory display with all the subdirectories of /assets. However, when I click on one of the sub directories, e.g. images I get and see the /assets directory again
/assets/10/images
If I click again
/assets/10/images/images etc et etc
Any suggestions are appreciated. Also with regards to getting logging activated. When I insert the logging command in the Virtual host directory, I get an error and when I put it in apache2.conf, I get an empty file.
Very frustrating all in all. And I've run out of things to try.
Cheers,
Marc
1 Reply
and If I'm not mistaken rewrite rules should go inside