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

248
Views
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 answers
Answer question

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 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!