Reputation: 273
I have the following regex:
RewriteRule ^blogs/([^/]*)/([^/]*) blogs/index.php?blogger=$1&blog=$2
This works fine for the following cases:
however it does not handle:
How can I make the "/" separator optional in this regex?
Upvotes: 0
Views: 909
Reputation: 5983
If the '?' is causing troubles then try:
^blogs/([^/]*)(/([^/]*)){0,1}
Upvotes: 0
Reputation: 154682
I'd use:
^blogs/([^/]*)(/([^/]*))?
And you'd just have to check and make sure that $2
is still correct (with the two capture groups, it might be $3
… I can't remember).
Upvotes: 1