![]() |
Peculiar mod_rewrite question
Hi there,
I have a rather strange URL from my client's old website that I need to redirect. It goes like this. I need to change this: http://www.mrmoco.com/index2.htm?sid.../Rigs/milo.htm Into this: http://www.mrmoco.com/Products/Rigs/milo.htm Basically, I just need to remove this part of the query string: "index2.htm?sidebar.htm&/" This rule should obviously only happen if such a string exists within the URL. It's not a customary query string. I don't know if that makes any difference, but it has stopped my simplistic solutions from working. Any help much appreciated. -Victor |
Something along these lines should do the job...
Code:
RewriteEngine OnCode:
RewriteEngine On |
That works a charm, thank you very much!
My only (hypothetical) question is, the rewrite condition will only match .htm files, is that correct? How could I get it to match any type of file? (eg. .PHP, .HTML etc.) -Victor |
Well you could just remove the \.htm part of the pattern, but this could potentially lead to false positives. A safer approach would probably be to include a whitelist like so \.(htm|php|foo)
|
Makes sense, thanks for your help!
-Victor |
| All times are GMT +1. The time now is 08:20 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.