Lumio Posted February 13, 2007 Share Posted February 13, 2007 Hello! I hope someone remembers my post in PHP Help. I tried to redirect a file to index.php. Now I thought when I do this it works: RewriteEngine On RewriteRule ^(.*)$ index.php But it redirects every file to my index.php. It doesn't matter if the file exists or not. that's a problem! I don't want to redirect every existing file. It takes too much resources when index.php takes every file. Quote Link to comment Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 Have a look at RewriteCond's -f. Quote Link to comment Share on other sites More sharing options...
Lumio Posted February 13, 2007 Author Share Posted February 13, 2007 thanks! I made it like that: RewriteRule ^(.*)$ index.php [f] But now I get an 403-Error. Why? Quote Link to comment Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 You're using RewriteRule. My link was to RewriteCond. Quote Link to comment Share on other sites More sharing options...
Lumio Posted February 13, 2007 Author Share Posted February 13, 2007 I know. But the examples gives me also RewriteRule. Can you give me an example with RewriteCond? thanks Quote Link to comment Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 See if these examples help. Quote Link to comment Share on other sites More sharing options...
Lumio Posted February 13, 2007 Author Share Posted February 13, 2007 now it doesn't redirect files that doesn't exist I mean... I got a directory like that: / |---- index.php |---- test.html |--- web/ |--- lumio/ |---- index.html |---- img.jpg So if I try to get www.myexample.com/index.html the realpath is www.myexample.com/index.php?file=/web/lumio/index.html But if I try to get www.myexample.com/test.html it is /test.html and not /web/lumio/test.html Also not if it exists. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.