mod_rewrite ignore directories with indexes
This is an open discussion with 5 replies, filed under Installation.
Search
Can we see the rule you have at the moment?
I'm still just using the default Symphony rules — if I comment out the directory ignore condition RewriteCond %{REQUEST_FILENAME} !-d
then Symphony content gets served correctly, but static directories with indexes do not.
Okey doke, figured this out. To have Apache rewrite empty real directories to Symphony but respect directories with indexes you need to change:
### MAIN REWRITE - This will ignore directories RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\/$ /oph/index.php?page=$1&%{QUERY_STRING} [L] </IfModule> DirectoryIndex index.php
to:
### MAIN REWRITE - This will ignore directories RewriteCond %{REQUEST_FILENAME}/index.html !-f RewriteRule ^(.*)\/$ /oph/index.php?page=$1&%{QUERY_STRING} [L] </IfModule> DirectoryIndex index.php, index.html IndexIgnore *
Now your existing static content should play nicely with Symphony.
Actually, that second last line needs to be:
DirectoryIndex index.html, index.php
Otherwise it messes up both the site and the Symphony administration root.
Just realised you don't need the DirectoryIndex index.html, index.php
line at all.
Create an account or sign in to comment.
I pretty much have no idea what I'm doing when it comes to setting RewriteRules, so I was hoping you guys could help me out.
I have a bunch of static content that I need to integrate with my Symphony-handled content. I have a page in Symphony called Exhibitions and I served content from an exhibition section based on the URI params — so
http://blah.com/exhibitions/title-of-entry/
— I'd like the static content served fromhttp://blah.com/exhibitions/online/random-directory-name/
.The problem I'm running into is that the URI structure I'd like to use for the static content conflicts with the Symphony content. I've set up the directory structure
exhibitions/online/whatever
and now when I navigate tohttp://blah.com/exhibitions/
it gives me the directory, rather than the Symphony page.Basically all I need to know is: is it possible to add a generic rule that says, redirect directories without an index to Symphony, but if there is an index, show it?