Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a problem that a marketing e-mail was sent out to clients with a link to our website, but it ended in a space. In other words, it goes to something like http://www.example.com/somepage/%20. Sending another e-mail with a correct link would probably be seen by the clients as spam, so we're trying to fix it on our end.

I tried adding a redirect rule to .htaccess, but it is failing before it gets to that point.

The Apache error log shows the following error:

(20024)The given path is misformatted or contained invalid characters: Cannot map GET /cost-per-invoice-calculator/%20 HTTP/1.1 to file

Any suggestions? This is Apache on a Windows server, if that is relevant...

share|improve this question

migrated from stackoverflow.com Feb 18 '10 at 16:10

This question came from our site for professional and enthusiast programmers.

3 Answers 3

OK, this is on a Linux server, but I don't appear to have a problem redirecting a URL that contains a space:

RewriteEngine on
RewriteRule ^.*test\ $ / [R=301,L]

This performs the following redirection:

http://localhost/test%20 -> http://localhost/ 

EDIT: Yes, as per Ernest Mueller's comment, this is in the server config, not in .htaccess

share|improve this answer

.htaccess is parsed pretty late in the game, I bet Cez was doing it in his httpd.conf, allowing it to proc before the bad character check that triggers on the space.

Also, if your Apache is fronted by some kind of load balancer or proxy or whatnot, doing the rewrite there would definitely work.

share|improve this answer

It looks like this is something that has been given status WONTFIX by the Apache team: https://issues.apache.org/bugzilla/show_bug.cgi?id=41441

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.