Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda