nobodyk Posted April 4, 2010 Share Posted April 4, 2010 here's my code: RewriteEngine on RewriteRule ^([^/]*)\.html$ /index.php?v=$1.jpg RewriteRule ^([^/]*)\.html$ /index.php?v=$1.gif RewriteRule ^([^/]*)\.html$ /index.php?v=$1.jpeg RewriteRule ^([^/]*)\.html$ /index.php?v=$1.png if I use the url http://mydomain.com/cat.html it works because index.php?v=cat.jpg exists but if the extension is not jpg is says the image does not exists. Shouldn't it go to the next rule instead? The problem with this code is that only the first rule is read, and it never processes the other rules. Can anyone help me? Quote Link to comment https://forums.phpfreaks.com/topic/197510-need-help-rewriting-rules/ Share on other sites More sharing options...
premiso Posted April 4, 2010 Share Posted April 4, 2010 The rewrite engine does not know to go on, it sees that rule and it matches so it executes, albiet since you do not have the [L] I would think it would but the rewrite engine is mysterious (even apache says it). I would just redirect it to index.php?v=$1 (no extension) and then do a search on index.php for v and check if file_exists if it does then yea use that extension. Quote Link to comment https://forums.phpfreaks.com/topic/197510-need-help-rewriting-rules/#findComment-1036607 Share on other sites More sharing options...
nobodyk Posted April 4, 2010 Author Share Posted April 4, 2010 good tip. thank you I will try that. Quote Link to comment https://forums.phpfreaks.com/topic/197510-need-help-rewriting-rules/#findComment-1036611 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.