views:

20

answers:

2

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?

+1  A: 

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).

David Wolever
Having the ? seems to remove the vars passed on to the script inn .htaccess
This worked I just needed the [QSA] flag
A: 

If the '?' is causing troubles then try:

^blogs/([^/]*)(/([^/]*)){0,1}
thomasfedb