Jump to content

Recommended Posts

Hello,

 

I am developing my first php script, I have a problem with the "not found" folders on the website.

Let's say I the user goes here:

http://mysite.com/folder1  but there are not folders there. At the moment I have this showing:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

 

 

 

With the htaccess, how can I reroute the user to let's say the index page of the website please?

 

 

Thank you,

 

 

 

Thank you for the documentation but unfortunately I am getting lost into it...

 

How would you simply tell the whole public_html folder that if there is a not found folder or file, redirect the user to the website root please?

 

I found this code online, would this be ok:

 

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/clients/$1/$2 !-f
RewriteCond %{DOCUMENT_ROOT}/clients/$1/$2 !-d
RewriteRule ^clients/([^/]+)/(.*)$ $2 [L]

 

 

Thank you,

Silently redirecting the user whenever they try to access a nonexistent resource is extremely confusing, especially for automated clients.

 

There's a good reason why we have error codes like 404. When a resource doesn't exist, the client should know.

Instead of apache, why not use php to first check for the file or folder and if it exists issue a header call to it, and if not put out a polite message.

 

OTOH - why do you have users typing in their own urls in the hopes that they make a hit somewhere?  Why not give them a drop down of the available folders/files and let them choose a correct one?

Thank you for your reply.

No the reason I was asking is because frameworks have a nice little routing script that do not allow people with the wrong access to go on a url.

I have coded the app with permission on the landing pages yes but was wondering how do framework stop people typing urls (to pass parameters).

 

Thank you,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.