[英]rewrite url and let more parameters
I am rewriting this kind of urls我正在重写这种网址
http://deia.info/category/calendar/10/
To到
/index.php?task=browse_posts&catid=$2
By this code in the .htaccess通过 .htaccess 中的这段代码
RewriteRule ^category/(.+)/(.+) /index.php?task=browse_posts&catid=$2
Which seems to do the job.这似乎可以完成这项工作。 The problem is when additional parameters are sent, those are ignored.
问题是当发送附加参数时,这些参数会被忽略。
For example:例如:
http://deia.info/category/calendar/10/?start_date=10
isset($_GET['start_date'])
won't return true isset($_GET['start_date'])
不会返回 true
Why?为什么?
When the incoming URL holds a query like in the OP example:当传入的 URL 包含类似于 OP 示例中的查询时:
http://deia.info/category/calendar/10/?start_date=10
The way to combine (Append) it with/to a new query in the substitution URL, is by adding the QSA Flag .将其与替换 URL 中的新查询组合(附加)的方法是添加QSA Flag 。
So add [L,QSA]
, like this:所以添加
[L,QSA]
,像这样:
RewriteRule ^category/(.+)/(.+) /index.php?task=browse_posts&catid=$2 [L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.