Frage

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

War es hilfreich?

Lösung

  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]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top