Jump to content

Prevent address from certain domain


Mudsaf

Recommended Posts

Hello, im not sure where to post this, but this prob would be htaccess question. How i can only allow users to go: http://innostus.info/ only with that domain, but not from my website subfolder: http://mudsaf.info/innostus_ky/Access:'>http://mudsaf.info/innostus_ky/Access: http://innostus.info/Deny access: http://mudsaf.info/innostus_ky/

Link to comment
Share on other sites

Hello, im not sure where to post this, but this prob would be htaccess question. How i can only allow users to go: http://innostus.info/ only with that domain, but not from my website subfolder: http://mudsaf.info/innostus_ky/ Access: http://innostus.info/Deny access: http://mudsaf.info/innostus_ky/
Just change where the root directory is in your Apache config file.
Link to comment
Share on other sites

One option might be to just redirect to the domain you want. I use this code to redirect on my index page if they aren't on the main domain. The primary URL is listed in $config['http_root']:

  // check host name  $prefix = (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on') ? 'http://' : 'https://';  $url_chunks = parse_url($config['http_root']);  $lms_host = $url_chunks['host'];  if ($_SERVER['HTTP_HOST'] != $lms_host)  {	$sess->redirect(str_replace('http://', $prefix, $config['http_root']));  }

If you want to put that in an include file that you include on every page, so it always redirects no matter which page they get to, then you can add $_SERVER['REQUEST_URI'] to the end of the redirect string to redirect them to the same page they were trying to access. My $sess->redirect method will just send a location header after closing the session.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...