In implementing clean URLs I wanted to map http://www.pikspeak.com/iframe/3/bird?autoplay=true to http://www.pikspeak.com/iframe.php?id=3&img=bird&autoplay=true using the following regex

RewriteRule ^/iframe/([^/\.]+)/([^/\.?]+)\\?([^/\.]+) /iframe.php?id=$1&img=$2&$3

But the problem is that the last character of the value of img get parameter (in this 'bird') is deleted, i.e. 'bir'. Can you please help out with this issue.

Other than that I am also not able to to get the 'autoplay' parameter in php.

Thanks in advance

有帮助吗?

解决方案

  1. I think by \\? you actually mean \?.
  2. No need to escape \. in character classes.
  3. Instead of trying to match the query string, use the [QSA] modifier.
RewriteRule ^/iframe/([^/.]+)/([^/.]+)$ /iframe.php?id=$1&img=$2 [QSA]
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top