Forum Moderators: phranque

Message Too Old, No Replies

catch all page

         

psavvy

6:35 pm on Oct 6, 2006 (gmt 0)

10+ Year Member


hi, how can i create a catch all page.

what i'm interested in doing is if a person tries browsing for a directory that does not exist eg. www.mywebsite.com/foobar/
i would like the server to figure this out and parse the request in a different file on www.mywebsite.com/account/index.php.

if would also like to keep the path that the user tried finding so /foobar/ part will still stay in the url but proccessed by the /account/ page.

Can anyone help me with this i'm totally stumped.

jdMorgan

7:15 pm on Oct 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is not recommended, as it creates duplicate content.

However, you can use mod_rewrite and check for directory or file exists, and then rewrite those requests to your catch-all.

Alternately, you can specify your 404 error page as an error-handling script using ErrorDocument.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

psavvy

7:47 pm on Oct 6, 2006 (gmt 0)

10+ Year Member



well the idea was: for the /account/ folder to check against the database, and see if the /foobar/ folder exists and load content based on that. instead of actually creating thousands variations of /foobar/ folders. there will be few physical files and folders. its mainly to have a place for users to easily browse to their profiles.

psavvy

7:54 pm on Oct 6, 2006 (gmt 0)

10+ Year Member



i guess that could work. would that best the best why of handling this situation? but wouldnt' that change the uri to something else then what the user has entered?

if someone entires mywebsite.com/paul/ i wouldnt' want it to change to something like mywebsite.com/404.html. it should still stay as /paul/. from there i can determine if the profile exists or not and take appropriate action.

jdMorgan

8:59 pm on Oct 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Give it a try and see...

Jim