Jump to content

need help rewriting rules


nobodyk

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.