How to handle non-existent subdirectories?

Posted by Question Overflow on Pro Webmasters See other posts from Pro Webmasters or by Question Overflow
Published on 2014-08-25T04:45:26Z Indexed on 2014/08/25 10:34 UTC
Read the original article Hit count: 303

Filed under:
|
|

I have a dynamic website with friendly URLs. Example:

  • Instead of /user.php?id=123, I have /user/123
  • Instead of /index.php?category=fishes, I have /fishes

But, how do I handle non-existent subdirectories such as /about/123? Currently it gives a 200 success instead of a 404 not found error. Is there a way to deal with non-existent subdirectories in Apache config and at the same time allow for friendly URLs? Or do I have to handle this individually for each PHP script?

© Pro Webmasters or respective owner

Related posts about php

Related posts about apache2