views:

808

answers:

1

I've used the following code to map https://live.example.com on to http://example.com/api

Options +FollowSymLinks

RewriteEngine On 

RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^live\.example\.com [NC]
RewriteRule (.+)$ "http://example.com/api/$1" [L,P]

The following url:

https://live.example.com/userlinks/xml/John%20James/MvPjeUTo15/

Is suppose to map onto:

http://example.com/api/userlinks/xml/John%20James/MvPjeUTo15/

Instead it maps it to:

http://example.com/api/userlinks/xml/John

So it seems to cut it at the space. I am using the Codeigniter framework but I am not sure if the problem lies there.

Also using %20 or just a space in the url bar produces no different results.

Anyone any idea and/or solution why this happens?

Thank you very much,

Ice

+1  A: 

I got it fixed:

Added to apache2.conf (httpd.conf):

RewriteMap escapemap int:escape

.htaccess:

Options +FollowSymLinks

RewriteEngine On 

RewriteCond %{HTTPS} =on
RewriteCond "%{HTTP_HOST}" "^live\.domain\.com" [NC]
RewriteRule "(.*)$" "http://domain.com/api/${escapemap:$1}" [L,P]

source: http://www.nabble.com/Re%3A-Re-users%40httpd--writeRule%2C--P--and-space-on-URL-p15632475.html