Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Rewriting a URL causing a 400 Bad Request

I'm trying to get around an HTTP 400 Bad Request with Apache that is caused when this URL is accessed (actual domain redacted):

http://example.com/nw/f/RUD/E.enc<space>

The URL ends with an actual space character, thus giving an HTTP 400 Bad Request. I cannot get the clients requesting this to remove the space in the URL, so I need to rewrite the URL without a space.

I've tried some RewriteRules, like this one (after enabling the RewriteEngine):

RewriteRule "^/nw/f/RUD/E(.*)$" /nw/f/RUD/E.enc [P]

The RewriteRule has no effect and is still giving an HTTP 400.

It even happens when I escape the space character instead of using the wildcard in the rule. Same thing if I try to replace the HTTP 400 error page to lead to the actual content (which wouldn't be ideal, since there's 4 different files).

How can I correctly rewrite the URL, removing the space on it, without getting HTTP 400?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your RewriteRule produces a redirect loop as .../E.enc<space> and .../E.enc both match .../E(.*)$. Better use a [R]edirect, though proxying also works.

RewriteEngine On
RewriteRule "^/nw/f/RUD/E\.enc $" /nw/f/RUD/E.enc [R,L]

or shorter

RewriteEngine On
RewriteRule "^(/nw/f/RUD/E\.enc) $" $1 [R,L]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!