Shoutbox

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=76634)

mod_rewrite help by Dempsey on 08-08-2007 at 06:36 PM

Anyone any good at mod rewrite?  I've having a few problems at mpsounds.net.

What I'm trying todo is:

/soundpacks/category/english  -->  /soundpacks.php?nonsearch=1&cat=english 

/soundpacks/category  -->  /soundpacks.php?nonsearch=1&catid=-1

/soundpacks  -->  /soundpack.php 

.htaccess

code:
RewriteRule ^soundpacks/category/(.+) soundpacks.php?nonsearch=1&cat=$1 [nc]
RewriteRule ^soundpacks/category soundpacks.php?nonsearch=1&catid=-1 [nc]
RewriteRule ^soundpacks soundpacks.php [nc]

/soundpacks/category/english and /soundpacks both work, but /soundpacks/category doesn't.  I don't really understand why.  Any ideas?
RE: mod_rewrite help by Nathan on 08-08-2007 at 06:52 PM

Maybe something like: (for the first one)
RewriteRule ^soundpacks/category/engligh/([a-z0-9]+)/$ soundpacks.php?nonsearch=1&cat=english


RewriteRule ^soundpacks/category/([a-z0-9]+)/$ soundpacks.php?nonsearch=1&catid=-1


RewriteRule ^soundpacks/([a-z0-9]+)/$ soundpacks.php




thats should do it :)


RE: mod_rewrite help by WDZ on 08-09-2007 at 02:21 AM

I copied and pasted your rules and they worked fine for me... :/

[Image: attachment.php?pid=841812]

Did you notice that you have 2 different variable names, cat and catid? :p

quote:
Originally posted by Napbree
RewriteRule ^soundpacks/category/engligh/([a-z0-9]+)/$ soundpacks.php?nonsearch=1&cat=english
Umm, I think the point is for the category ('english' for example) to be dynamic. =p
RE: mod_rewrite help by Dempsey on 08-09-2007 at 07:21 AM

quote:
Originally posted by WDZ
I copied and pasted your rules and they worked fine for me... :/
Oh maybe its not the rewrite thats the prob then its my php :P
quote:
Originally posted by WDZ
Did you notice that you have 2 different variable names, cat and catid? :P
Yea catid is a number and cat is text, is because I've recently changed it to remove nubmbers from the url, eg /soundpacks/1_english