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

252
Visualizações
How to redirect a wrong url to error page

Hello guys i am building up a project in php and facing issues regarding the wrong url my actual url is like this http://localhost/blog_dir/blog/top-of-the-world so when i am hitting to this url i can see the actual page that i want to see but when i am typing a wrong url like http://localhost/blog_dir/blog/top-of-the-w it shows me error like the notices, warnings and all the common errors of php into that page which is quite obvious as it is not getting the proper url. So what do i want to do is that if any user types wrong url then they must get redirected to the error page that i have created which is err.php. One more thing i would like to add is that the problem arises i think is due to the codes that i have written in my .htaccess. So i am adding up my .htacces code here

RewriteEngine On 
ErrorDocument 404 http://localhost/blog_dir/err.php

#RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^blog/([^/\.]+)?$ blog-de.php?post=$1 [L,QSA]

I hope you could help me out with my project....

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

This one can resolve your issue :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . / [L,R=301]

ErrorDocument 404 path_to_error_page

NB: replace path_to_error_page with the path to the error page.

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