We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.

More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsphpBB

How to Prevent Forum Direct Access

Generally, direct access of the forum can be prevented in the case there is a need to keep it more private and secured. The meaning of disabled direct access to the forum is to provide access only by going through the specific website which is not the actual forum.

  • For example, there is a website which going to be used for letting visitors to enter the forum and the forum itself. Then lets say when the visitor is opening the home page of the website and click’s on the link to the forum, he’s entering the forum. All other page from the same website won’t be allowed to use for opening the forum.
if ($_SERVER['HTTP_REFERER'] != $url) {
header('Location: redirect.php');
  • This is the basic solution for preventing direct access of the forum. Here is how to implement it┬áprogrammatically.
  • Simply replace “http://website\.com” in the code with the actual website which will be used for letting visitors to access the forum. Also, put PHP redirect code inside the file “redirect.php” which will be used to redirect from the website to the forum.

That’s it, from now the forum will be available only by opening it through website home page while other attempts to visit the forum will be rejected.

Rate this Tutorial:
No CommentsLeave a Comment

Other (199)

Popular Keywords