H
H
Heyhihello2016-05-17 13:26:41
Web development
Heyhihello, 2016-05-17 13:26:41

How to block access to the site from other domains?

Hello! I'm actively developing the SquadyFinder project, which is located at: squadyfinder.com
The project is developed on Laravel, deployed on DigitalOcean (512 MB Memory / 20 GB Disk / FRA1 - Ubuntu 15.10 x32)
The domain was purchased from https://www.namecheap.com /
Thanks to Yandex.Metrica, I found out that my project is also available from other domains, for example:
rewoi989s.com
g0293.com
77kinglion.info
adstprem3983.com
I tried to configure Apache, but the site crashes both on my domain and on others. I suspected that on those domains the project was loaded in an iframe, since I tried to register there or subscribe to an email newsletter - everything goes into my database. And if I make any changes in the project, they also immediately change there.
Has anyone come across this problem and can suggest how to solve it? Maybe I configured something wrong? Thanks in advance.
.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    #Normal way (in case you need to deploy to NON-heroku)
    RewriteCond %{HTTPS} !=on

</IfModule>

+ Solution if anyone needs it:
RewriteEngine On
RewriteCond %{http_host} !^squadyfinder.com [nc]
RewriteRule ^(.*)$ http://squadyfinder.com/$1 [r=404,nc]

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Ergil Osin, 2016-05-17
@Heyhihello

Bury the corpse of an old Indian.
For nginx do this:

if ($host !~* ^(site.xxx)$ ) {
                return 444;
        }

And that's all, if they come to us not for site.xxx, but for something else, then they will receive a connection reset.

X
xmoonlight, 2016-05-17
@xmoonlight

Put in the page template, in the header section (and, of course, the web server config - must also be configured):

<script type="text/javascript" language="javascript">
  if(self!=top) top.location=self.location;
</script>

A
Aleksandr, 2016-05-17
@cyberspy

.htaccess?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question