.htaccess regex rewrite rule
问题 I have the following regex: RewriteRule ^blogs/([^/]*)/([^/]*) blogs/index.php?blogger=$1&blog=$2 This works fine for the following cases: http://myurl.com/blogs/blog-name/blog-article/ http://myurl.com/blogs/blog-name/blog-article http://myurl.com/blogs/blog-name/ however it does not handle: http://myurl.com/blogs/blog-name How can I make the "/" separator optional in this regex? 回答1: I'd use: ^blogs/([^/]*)(/([^/]*))? And you'd just have to check and make sure that $2 is still correct (with