Jump to content

What's wrong with these rules?


nobodyk

Recommended Posts

If the user goes to thumb-231313.jpg it takes them to index.php?v=$1 rule

Any thoughts?

RewriteEngine on
RewriteCond %{HTTP_HOST} !^uploadpic\.org$ [NC]
RewriteRule ^(.*)$ http://uploadpic.org/$1 [QSA,L,R=301]
AddType application/x-httpd-php .html
php_flag register_globals on
RewriteRule ^thumb-(.*).jpg$ view-image.html?img=$1&w=160&h=160 [QSA]
RewriteRule ^showpic-(.*)/(.*)$ view-pic.html?img=$1 [QSA]
RewriteRule ^download-(.*)/(.*)$ view-pic-original.html?img=$1&dl=1 [QSA]
RewriteRule ^showoriginal-(.*)/(.*)$ view-pic-original.html?img=$1 [QSA]
RewriteRule ^([^/]*)\.html$ /index.php?v=$1 [L]

Link to comment
https://forums.phpfreaks.com/topic/198084-whats-wrong-with-these-rules/
Share on other sites

It would appear that because you're rewriting all traffic to .html files to index.php, you're rewriting the image to the html file, and then this is being rewritten to the php file, per the last RewriteRule. If you're saying this behaviour is unwanted, try using the last rule flag [L].

As alex3 has correctly identified, the problem is that your rewritten address matches another pattern further down the page (the last one). The solution offered should have fixed this issue. If the problem is indeed solved can you please mark the topic 'Solved' using the 'Mark Solved' button located at the bottom left corner of a thread you started.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.