Mod_Rewrite Help - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Mod_Rewrite Help (/showthread.php?tid=65900)
Mod_Rewrite Help by Dempsey on 09-06-2006 at 10:30 AM
On the old MPSounds site SoundPacks were linked to like
www.mpsounds.net/?id=pack&id2=342,
but now they are like
www.mpsounds.net/soundpack.php?id=342
There seems to be quite a few links to the old soundpack style so I am getting a lot of 404 errors in my logs.
I'm trying to add a Mod_Rewrite rule, but so far with no luck, just wondering if anyone can help?
This is what I've tried:
code: RewriteEngine on
RewriteRule ^\?id=pack&id2=([0-9]+)$ soundpack.php?id=$1 [R]
RE: Mod_Rewrite Help by rav0 on 09-06-2006 at 11:00 AM
Try this out:
code: RewriteEngine on
RewriteRule /?id=pack&id2=(.*)$ /soundpack.php?id=$1 [R=301,L]
I'm not sure if it works .
RE: Mod_Rewrite Help by Dempsey on 09-06-2006 at 11:05 AM
quote: Originally posted by rav0
RewriteRule /?id=pack&id2=(.*)$ /soundpack.php?id=$1 [R=301,L]
Na still doesnt wanna work
RE: Mod_Rewrite Help by alexp2_ad on 09-06-2006 at 11:15 AM
code: RewriteCond %{QUERY_STRING} ^id=pack&id2=([0-9]+)$
RewriteRule ^$ /soundpack.php [R]
Is a lot closer but still not close enough I'm afraid. You can't match a query string question mark by using \? it treats it as a literal question mark in the file name.
You could just redirect using php could you not?
RE: Mod_Rewrite Help by Dempsey on 09-06-2006 at 11:19 AM
quote: Originally posted by alexp2_ad
code: RewriteCond %{QUERY_STRING} ^id=pack&id2=([0-9]+)$
RewriteRule ^$ /soundpack.php [R]
Is a lot closer but still not close enough I'm afraid. You can't match a query string question mark by using \? it treats it as a literal question mark in the file name.
You could just redirect using php could you not?
oh ok, thanks for the help
I could just do it using php yea, but mod_rewrite would have been my preferred method as the index.php is now the MyBB portal page, meaning I'd have to update it everytime I update MyBB.
RE: RE: Mod_Rewrite Help by alexp2_ad on 09-06-2006 at 11:24 AM
quote: Originally posted by Dempsey
quote: Originally posted by alexp2_ad
code: RewriteCond %{QUERY_STRING} ^id=pack&id2=([0-9]+)$
RewriteRule ^$ /soundpack.php [R]
Is a lot closer but still not close enough I'm afraid. You can't match a query string question mark by using \? it treats it as a literal question mark in the file name.
You could just redirect using php could you not?
oh ok, thanks for the help
I could just do it using php yea, but mod_rewrite would have been my preferred method as the index.php is now the MyBB portal page, meaning I'd have to update it everytime I update MyBB.
Well, at least with that one I gave you you could redirect using the php in soundpack.php
But I'll see if I can dig up something better, it must be possible.
EDIT: I got it!
code: RewriteCond %{QUERY_STRING} ^id=pack&id2=([0-9]+)$
RewriteRule ^$ /soundpack.php?id=%1 [R,NE]
RE: Mod_Rewrite Help by Dempsey on 09-06-2006 at 11:36 AM
quote: Originally posted by alexp2_ad
EDIT: I got it!
code: RewriteCond %{QUERY_STRING} ^id=pack&id2=([0-9]+)$
RewriteRule ^$ /soundpack.php?id=%1 [R,NE]
Thanks thats great Does just the job
|