I want to build a website that has 18+ content on it. Doesn't matter if it's alcohol, tobacco or some adult content on it. Point is that it needs to be done to be available only for 18+.

The most easiest way that I figure is to put a basic index.html file with intro note saying something like "Are you old enough to enter" or "This site has 18+ content. Enter if you are 18+".

Is just warning on this intro site enough or is there some common practice that should be done on that subject?

For example, if someone is let's say 16 y.o. he or she can easily click that he or she has 18+ and enter the site. Is there any way to lower this situation on minimum, or is just a notice on the intro page that is enough?

  • I edited the question to narrow down too broad answers.
    – Josip Ivic
    Nov 26, 2015 at 15:22
  • This has a flaw. Just visit example.com/not-home, I'll never get a message. You should set a $_SESSION value if someone passes your test. No value? No access.
    – Martijn
    Nov 26, 2015 at 15:31
  • What country are you in? What country is your website hosted in? What countries are your users in? Different countries have different laws, and no one can being to answer your question without knowing which countries' laws apply to you.
    – Mike Scott
    Nov 28, 2015 at 16:36
  • Does it really matter in which country I am?
    – Josip Ivic
    Nov 30, 2015 at 13:52
  • whoever downvoted this, why did you do that? care to explain maybe?
    – Josip Ivic
    Aug 10, 2016 at 12:49

6 Answers 6


There is no way to do ensure someone is over 18 without additional work (either from you or the viewer or both).

Having people register and require scanned ID or similar could work, as could require entry of a valid credit card number to create an account. Neither of these are anywhere close to fullproof, but they significantly raise the bar in terms of reducing your liability if someone under-age does view the content, but similarly will turn off a lot of casual potential viewers.

I note that different countries have different laws - its probably not practical to comply - or even try to comply with them all - that said, hosting in a different, liberal, jurisdiction may offer some (practical) protections to you.


This is not legal advice, but I know someone who runs several adult sites. He puts up the warning page with the 18 U.S.C. Section 2257 Compliance Notice and that's it.

I'm not sure there is a way to verify a users age when they are underage.

Obviously this is not enough, the parents may have to employ tools to prevent access.

The site owner has no other option from my experience.

  • It's ok if you are living in US. I'm in Europe.
    – Josip Ivic
    Nov 30, 2015 at 13:52

I'm leaving the legal part to others, I'm replying about the implementation:

Using an index.html is a terrible idea. Say your website has pages indexed somewhere, or some forum has a few backlinks. If they where to link to example.com/some-page(.html), they would never see the warning.

Use PHP (or another language which can store sessions), and if !isset($_SESSION['userClickedYesAdult']) show question, otherwise show requested page.


I'll give you a simple answer. Yes. Legally, just the notice would help you out of the trouble. But, if you need to verify their identity, the solution would go complex. To either get a video or webcam snap, check for age using image recognition etc.

  • webcam snap? can you elaborate that please :)
    – Josip Ivic
    Nov 27, 2015 at 19:28
  • Initiate a popup to snap a photo using the webcam. And compare it with the profile photo. So, you should ask the user to add a recent photo. And another solution will be good like video verification like one used in elance.
    – Arun Anson
    Dec 4, 2015 at 14:00

What an interesting question.

It all depends on how you expect the users to use your site:

If you want users to visit your adult site for a minute just to get one or two things, then at the very least, have the users read an agreement, then verify they read it by having them answer a skill-testing question that adults can only understand and then if successful, make the server send a cookie to the client browser so the client is then authorized to access the site.

If you expect users to do more involved actions on your site (like adult item shopping as opposed to looking at one and only one picture), then you could require users to create accounts then make them verify their email address and require them to send a recent photo of themselves.

Point is, just make sure users are verified as adults and when they are, the server can send a special cookie to the user's browsers to identify them as adults.

Having all html adult pages public including the index html page as a warning page isn't good enough because if an adult enters the site and is greeted with the index page and decides to declare himself as an adult, he is then taken to the next page on the site. He could tell a kid the new URL and the kid could type it in and BAM! kid sees adult content.

You will need to learn some kind of programming language such as PHP if you want to be able to run this kind of site successfully.

And whatever you do, don't think about getting the adult portions of the site indexed with google or any search engine unless you make the pages family-friendly enough for google.


Also: study the html of other adult websites hosted in the same geographical location as your host.

See what they do to label their content as adult, so parental controls can pick it up and prevent unintended access by minors. Also visit the websites of parental control products like NetNanny, and follow their advice.

It won't keep out determined minors, but together with a first-visit-based notification and compliance with local law where your website is hosted, you should be good.

Also see whether the laws differ between where the website owner lives and where the website is hosted. The owner is likely to be held responsible according to applicable law.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.