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

139
Views
RewriteRule in .htaccess for directories destroys general 404 ErrorDocument and creates 500

I added a RewriteRule to make the path of '/some-page' opening the '/some-page/index.php' but showing '/some-page/' in the browser's address bar. This works fine as expected.

On the other hand I have now the problem that whenever I type a not-existing path like e.g. '/this-does-not-exist.html' I am prompted a 500 message and not redirected to the 404 page anymore.

And if I type e.g. '/kontakt' I am prompted with an 404. But if I type '/kontakt.php' it works. It should show '/kontakt.php' if I type '/kontakt' and should show '/kontakt' in the browser's address bar.

Here is the part of my .htacces:

ErrorDocument 400 /400.php
ErrorDocument 401 /401.php
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
ErrorDocument 503 /503.php

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L]
over 4 years ago · Santiago Trujillo
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!