Domanda

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

È stato utile?

Soluzione

  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]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top