Reputation: 1101
I need help writing a simple regex for RewriteRule for mod_rewrite in htaccess. So, here is what I am trying to accomplish:
books/2010-the-world-by-hopkins-139_PPS-1234567
should go to
index.php?pagename=mypage&PPS=1234567&description=2010-the-world-by-hopkins-139
So, in pseducode, the regex has to split the part after books
by _
and I should get it into two parts:
_PPS-
_
.I guess the RewriteRule will be something like:
RewriteRule books/(.*)_(.*) index.php?pagename=mypage&PPS=$2&description=$1
But I need correct regex. Plese help.
Upvotes: 0
Views: 214
Reputation: 21864
something like: but flip the $1 and $2 ;)
^books/(.*)_PPS-([0-9]{1,})$
Upvotes: 1