redirect to url with spaces

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 9
Joined: 09 Aug 2012, 11:24

redirect to url with spaces

10 Mar 2015, 15:12

I am trying to create a redirect to a client document that has spaces in it and am not being successful. Here are the rules I have tried:

RewriteRule ^userfiles/file/originalfile.pdf$ /userfiles/file/new file.pdf [NC,R=301,L]
RewriteRule ^userfiles/file/originalfile.pdf$ "/userfiles/file/new file.pdf" [NC,R=301,L]
RewriteRule ^userfiles/file/originalfile.pdf$ /userfiles/file/new%20file.pdf [NC,R=301,L]
RewriteRule ^userfiles/file/originalfile.pdf$ "/userfiles/file/new%20file.pdf" [NC,R=301,L]
RewriteRule ^userfiles/file/originalfile.pdf$ /userfiles/file/new\sfile.pdf [NC,R=301,L]
RewriteRule ^userfiles/file/originalfile.pdf$ "/userfiles/file/new\sfile.pdf" [NC,R=301,L]

Nothing seems to work. Basically the when the redirect happens, the spaces in the destination URL are not being maintained. Any help would be appreciated.

User avatar
Posts: 9
Joined: 09 Aug 2012, 11:24

Re: redirect to url with spaces

10 Mar 2015, 15:45

Never mind. I figured it out. Here is what I ended up with:

RewriteRule ^userfiles/file/originalfile.pdf$ /userfiles/file/new\ file.pdf [NC,R=301,L]

I just escaped the space itself.

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 24 guests