Jump to content

[SOLVED] 403 php error.


Shilo

Recommended Posts

To start off with my problem I will give you some code:

 

.htaccess:

ErrorDocument 403 /index.php?status=403
ErrorDocument 404 /index.php?status=404

 

and the code of the /index.php?status=403:

<?php
	case "403":
		$titleE = "403 Error - Forbidden";
		$messE = " ::  You do not have access to this area!";
		$error = $bst.$titleE.$messE.$ben;
	break;
?>

 

This works fine and displays "403 Error - Forbidden :: You do not have access to this area!" and shows it in an error box with the default homepage.

 

svaerror.jpg

 

now heres the problem. It displays "localhost/require/" at the top of the page. This is because I was trying to access the "require" directory of my website. but when I click on a new link I get this error:

 

svaerror2.jpg

 

See the problem. Its trying to find file "localhost/require/index.php?blablabla..."

 

is there a way to make the htaccess direct the page to index.php?status=403 but in the root directory and not the require directory?

Link to comment
Share on other sites

The true error url isn't shown its masked by the url the error was generated it so the error page is in the root directory and called from in there

 

by putting ErrorDocument 403 /index.php?status=403 you are saying the document for error 403 is in the / root to where ever that htaccess is

 

the other option is if your htaccess isn't in your root http folder to define the full http path (which really you only need the main htaccess file in the root, any other htaccess files in other directorys should really be small situration changes)

 

ErrorDocument 403 http://mysite.com/index.php?status=403

 

 

Link to comment
Share on other sites

The true error url isn't shown its masked by the url the error was generated it so the error page is in the root directory and called from in there

 

by putting ErrorDocument 403 /index.php?status=403 you are saying the document for error 403 is in the / root to where ever that htaccess is

 

the other option is if your htaccess isn't in your root http folder to define the full http path (which really you only need the main htaccess file in the root, any other htaccess files in other directorys should really be small situration changes)

 

ErrorDocument 403 http://mysite.com/index.php?status=403

 

Are you serious?! Thats all I had to do. Grr.

I cant thank you egnouph man! Have a good night.

 

TOPIC SOLVED!

Link to comment
Share on other sites

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.