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

151
Visualizações
How to not redirect to 404 page for a specific domain page

I wanted to add a 404 page to my website but i had some problems.

I made a .htaccess file:

ErrorDocument 404 /404.html

It works fine but i don't want that to give a 404 everytime.

What i want is that the htaccess dosn't redirect you to the 404 page, for a specific domain name page.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you don't want that ErrorDocument to be defined for a specific domain then enclose the ErrorDocument directive in a negated <If> expression that checks that the requested Host header is not example.com (the domain you want to exclude).

For example (requires Apache 2.4):

<If "%{HTTP_HOST} != 'example.com'">
    ErrorDocument 404 /404.html
</If>

The ErrorDocument is defined for every requested host, except example.com. (Obviously, you'll still get a 404 response for this other domain, when requesting a non-existent resource, but /404.html will not be served.)


Aside:

the htaccess dosn't redirect you to the 404 page

Probably just terminology, but there is no "redirect" (as in an external 3xx redirect) here to begin with. The error document is served with an internal subrequest. You could change the ErrorDocument directive so that it does trigger a "redirect", but that is rarely desirable.

about 4 years ago · Juan Pablo Isaza 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