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

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

How to Prevent Forum Direct Access

KVM VPS
cPanel KVM
Germany Cloud Servers
OpenVZ VPS
Linux KVM Hosting
USA VPS
Linux Cloud Server
Windows Cloud Server
Ubuntu VPS
Brazil VPS

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.
1
2
3
4
5
6
7
<?php
$url='http://website\.com';
if ($_SERVER['HTTP_REFERER'] != $url) {
header('Location: redirect.php');
exit();
}
?>
  • 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.

KVM VPS
OpenVZ VPS
Linux Cloud Server
Windows Cloud Server
Ubuntu VPS
Brazil VPS
cPanel KVM
Linux KVM Hosting
Germany Cloud Servers
USA VPS
Rate this Tutorial:
No Comments Leave a Comment
Leave a Comment

Other (199)

Popular Keywords