1

I want to rewrite the URL when receiving a request that is not a file and either for directory subdir or not a directory at all.

E.g. (!file) && ( (subdir ) | ( !directory ) )

Here's my .htaccess:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(subdir|subdir/.*).*$ [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) index.php?request=$1 [QSA]

It works everywhere except for subdir. The rewrite condition to catch subdir is not working, it behaves as if there is no rewrite rule at all. What am I doing wrong here?

1 Answers1

1

Ok, my fault. I'm an idiot. I'm not working at web root, I'm working within a subdirectory from the web root. Which means that:

RewriteCond %{REQUEST_URI} ^/(subdir|subdir/.*).*$ [OR]

was looking in the wrong place. I should have done

RewriteCond %{REQUEST_URI} /(subdir|subdir/.*).*$ [OR]

or

RewriteCond %{REQUEST_URI} ^/mydivision/(subdir|subdir/.*).*$ [OR]