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. Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/ Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 Have a look at RewriteCond's -f. Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/#findComment-183578 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? Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/#findComment-183726 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. Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/#findComment-183736 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 Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/#findComment-183748 Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 See if these examples help. Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/#findComment-183827 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. Link to comment https://forums.phpfreaks.com/topic/38277-dont-redirect-existing-files/#findComment-183919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.