FabioCosta
FabioCosta

Reputation: 2749

htaccess mod_rewrite conflicting with zip file behavior

I have the following .htaccess on my root web folder

RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ /foo-bar/$1 [L,NC]

On the same level i have a file foo.zip

Inside foo-bar i have a css file on a folder foo,so the physical path is ~/foo-bar/foo/baz.css and the desired Web path would be www.mysite.com/foo/baz.css

So the file structure is:

ROOT: .htacces,foo-bar(folder) ,foo.zip

ROOT/foo-bar/: baz.css

If i leave the zip it doesn't work , outputing the following message:

The requested URL /foo-bar/redirect:/foo-bar/foo.zip/baz.css/baz.css was not found on this server.

Note that the zip is NOT on foo-bar its on the same level.

Simply renaming the zip solves the problem , but i would like to know the cause.

Upvotes: 1

Views: 81

Answers (1)

anubhava
anubhava

Reputation: 785541

Try changing your rule to:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!foo-bar/).*)$ foo-bar/$1 [L,NC]

Upvotes: 1

Related Questions