Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda