[Typo3-dev] restrict viewers by IP

Olaf Döring mail at olaf-doering.de
Thu Oct 21 10:18:15 CEST 2004


Steve Turnbull wrote:
> ...
> > Is it possible to restrict who can view certain pages according to their 
> IP address/address range?

Hi,
it's a simple piece of typoscript code. I have a restricted area in my
website, which is visible from our intranet (192.168.200.x), an only
visible from extern after you are loged in as FE user.

My typoscript code is:

#Asign content first
page.10.marks.CONTENT < styles.content.get
#If we are in the restricted area (PID=23)
[PIDinRootline=23]
      page.10.marks.CONTENT=COA
      page.10.marks.CONTENT.10=TEXT
      page.10.marks.CONTENT.10.value=<h1>Interner LKV-Bereich</h1><p>Die
aufgerufene Seite liegt im Internbereich der LKV-Seite.<br />Diese sind nur
aus dem Intranet oder nach erfolgreicher Anmeldung zugängig.<br><br>Wenn
Sie sich anmelden wollen, <a href="index.php?id=111">klicken Sie
hier.</a><br></p>
#      "styles.content.loginform" does not do with "css_styled_content"
#      page.10.marks.CONTENT.20=HTML
#      page.10.marks.CONTENT.20 < styles.content.loginform
[global]
#If we are in our intranet
[IP=192.168.200.*]
      page.10.marks.CONTENT >
      page.10.marks.CONTENT < styles.content.get
[global]
#If loged in, we will also see content
[loginUser = 1]
      page.10.marks.CONTENT >
      page.10.marks.CONTENT < styles.content.get
[global]
...


This works fine for me. You must use this piece of script for every Type of
page you have. (normal, printlauyout,...).
If you have further questions, ask me.

Olaf




More information about the TYPO3-dev mailing list