problems with special characters in rewrite

New to mod_rewrite? This is a good place to start.

problems with special characters in rewrite

Postby pastorhusk » Wed Sep 30, 2009 8:16 am

Hi,

I have a long url with various parameters used by a mediaplayer (flowplayer), that I want to simplify for visitors.

My problem is that there are various characters in the config url that seem to cause problems. The first part of the rewrite brings the visitor to the media player page, but the configuration parameters are lost along the way.

Here's the rewrite rule:
RewriteRule ^(.*)/(.*)/flowplayer\.swf$ /flowplayer-3.1.2.swf?config={"clip":{"url":"/video/$2.flv","autoPlay":false,"autoBuffering":true},"plugin
s":{"controls":{"url":"/flowplayer.controls-3.1.2.swf","time":true,"volume":false,"fullscreen":false}}}

I'm guessing that the characters '{','}',',','"', and ':' are part of the problem. I've tried escaping them like this \{ etc, but without any luck.

Can anyone advise me on what the problem may be?

Thanks!
pastorhusk
 
Posts: 1
Joined: Wed Sep 30, 2009 8:07 am

Postby richardk » Wed Sep 30, 2009 1:10 pm

I used a PHP file instead and the query string was fine. Could you try that?

Try
Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteRule ^[^/]+/([^/]+)/flowplayer\.swf$ /flowplayer-3.1.2.swf?config={"clip":{"url":"/video/$1.flv","autoPlay":false,"autoBuffering":true},"plugins":{"controls":{"url":"/flowplayer.controls-3.1.2.swf","time":true,"volume":false,"fullscreen":false}}} [QSA,L]


I'm guessing that the characters '{','}',',','"', and ':' are part of the problem. I've tried escaping them like this \{ etc, but without any luck.

To escape them you would use percent-encoding but you have to escape the %, eg. "\%20" for a space. But i don't think that's the problem.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 33 guests

cron