开发者

HTAccess mod rewrite issue using QSA

I want to add a parameter to a URL but currently it isnt showing in the $_GET global. A snippet from my htaccess file is as below:

RewriteRule ^account/blogs/([0-9]+)/([^\s?]+)/?$ /account/blog.php?blogId=$1 [L,QSA]

Then in 开发者_StackOverflowmy php code i want to add a link such as:

/account/blogs/1/ThisIsWhereTheTitleGoes?delete=1

The wildcard (any char but space) option is for the blog title as i never know what it would be. I know want to add a query string param on the end such as ?delete=1. I however dont want this as part of the rewrite.

Does anybody know how to so this? Thanks


My best bet would be to simply add get variables to the regex, like so:

RewriteRule ^account/blogs/([0-9]+)/([^\s?]+)/?(\?(.*))?$ /account/blog.php?blogId=$1&$4 [L,QSA]

This would rewrite

/account/blogs/1/ThisIsWhereTheTitleGoes?delete=1

to

/account/blog.php?blogId=1&delete=1

It would also support additional variables.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜