views:

168

answers:

0

I've been messing with what should be a fairly simple rewrite rule, and have kinda got it working.

The rule I have is

    RewriteCond %{REQUEST_URI} !\.(php|html|css|js|gif|png|jpe?g)$
    RewriteRule (.*)$ /index.php [L]

All I'm trying to do is take anything beyond the home directory to get passed as a request and from there I'll pick it apart and pass it on to the correct page.

What I have is quite strange. If I go to the main page http://devHW it works! if I pass a non-existent subdirectory http://devHW/test1, it works! and test1 gets passed as the REQUEST_URI.

If I go to http://devHW/test1/, the page loads, but the css and images with virtual paths won't load. Same if I continue to build upon that url http://devHW/test1/test2 for example.

my understanding of the rewite condition and rule I have is that anything beyond the root directory will be passed as the request when not ending in the file extensions supplied. However, apparently that isn't what I've got, and I can't seem to find anything that works as well as what i've got. I feel like I'm getting really close on this one.

Edited -----------solved

Not sure if this was the best way to do it, but I changed all the virtual paths to start with a forward slash. Seems to work.