0

I would like to exclude mod_rewrite for a certain directory.

I want the folder "phd_application" not to be rewritten, that is, when a url points to

www.myserver.com/phd_application 

it goes to that folder.

It works when uploaded on the web server but doesn't work locally, and I don't understand why. I have the same .htaccess file locally and remote. What am I missing?

I have the following .htaccess

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule    ^(phd_application/) - [L]
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

The content of the directory where the .htaccess reside

-rwxr-xr-x   1            183 Dec 19 12:43 .htaccess
drwxr-xr-x  13             18 Dec 13 15:44 app
lrwxrwxrwx   1             15 Dec 13 14:48 cake -> ../CakePHP/cake
-rwxr-xr-x   1           1850 Dec 13 15:14 index.php
drwxr-xr-x   3              8 Dec 19 12:46 phd_application
lrwxrwxrwx   1             18 Dec 13 14:49 plugins -> ../CakePHP/plugins
lrwxrwxrwx   1             18 Dec 13 14:50 vendors -> ../CakePHP/vendors

1 Answer 1

1

What does the log say ? Enable the rewritelog on the local machine and check what happens.

FYI excluding one location from an otherwise global rewrite is much better done with a RewriteCond.

Example:

   RewriteRule    ^$ app/webroot/    [L]
   RewriteCond    ${REQUEST_URI} !^phd_application/
   RewriteRule    (.*) app/webroot/$1 [L]
3
  • Could you give an example of how it should be done?
    – kaklon
    Dec 19, 2011 at 13:16
  • Thank you for the example, but don't change the outcome. The log shows the condition isn't taken in account and redirected to app/webroot/phd_application, that the third rule is applied
    – kaklon
    Dec 19, 2011 at 13:44
  • Argh, stupid me the directory name was not the same locally, I am trully sorry. I looked over and over but didn't see that
    – kaklon
    Dec 19, 2011 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .