#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2017
    Posts
    6
    Rep Power
    0

    Sub Folder Page 404 to New Page


    Hi All,
    I am wondering if anyone knows of any way that if a page responds with a 404 response code within a specific sub folder (events) that a RewriteRule can re-direct that back to the parent of /events

    For example - /events/event-32010212 responds with 404 so goes to /events
  2. #2
  3. Wiser? Not exactly.
    Devshed God 2nd Plane (6000 - 6499 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    6,288
    Rep Power
    4194
    You shouldn't redirect a 404 response, it may mess up how search engine interpret your URL by making those non-existent URL's appear to exist but just be redirects.

    Setup a custom error handler which still returns a proper 404 status code but could output a page similar to your /events page with an additional note about the requested event not existing.

    For apache you'd do this by configuring an ErrorDocument for that directory.

    side note: this thread should probably be moved. It doesn't involve regex at all.
    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud

IMN logo majestic logo threadwatch logo seochat tools logo