Forum Moderators: phranque
[edited by: phranque at 8:22 pm (utc) on Oct 28, 2017]
[edit reason] exemplified domain [/edit]
You have to make sure through htaccess that your website using "your domain" instead of scraper domain.
The link I give you in the last post will solve your problem.
Thanks, 1:
#Force www:
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
2:
#Force non-www:
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] https://forums.cpanel.net/threads/can-i-stop-someone-from-displaying-my-website-on-his-domain.532661/ RewriteEngine on
RewriteCond %{SERVER_NAME} ^(www\.)?anotherdomain\.com$ [OR]
RewriteRule ^ - [F] accept by htaccess but it is giving my access denied error on my domain as well... it is giving my access denied error on my domain as well
<script type="text/javascript"><!--
document.write("<a href='http://www.example.ru/click' "+
"target=_blank><img src='//counter.example.ru/hit?t12.11;r"+
escape(document.referrer)+((typeof(screen)=="undefined")?"":
";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?
screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+
";"+Math.random()+
"' alt='' title='LiveInternet: показано число просмотров за 24"+
" часа, посетителей за 24 часа и за сегодня' "+
"border='0' width='88' height='31'><\/a>")
//--></script>
[edited by: anthonyinit_2017 at 6:36 am (utc) on Nov 4, 2017]
a2enmod rewrite headers service apache2 restart apache2ctl restart Header append X-FRAME-OPTIONS "deny" # Enable Rewriting
RewriteEngine on
# Custom Rules START #
Header append X-FRAME-OPTIONS "deny"
RewriteEngine on
Order Deny,Allow
Deny from all
SetEnvIfNoCase User-Agent .*ozilla/5.* good_bot
SetEnvIfNoCase User-Agent acm.* good_bot
SetEnvIfNoCase User-Agent .*acme.* good_bot
SetEnvIfNoCase User-Agent auto.* good_bot
SetEnvIfNoCase User-Agent .*auto.* good_bot
SetEnvIfNoCase User-Agent bin.* good_bot
SetEnvIfNoCase User-Agent .*bing.* good_bot
SetEnvIfNoCase User-Agent .*ncryp.* good_bot
SetEnvIfNoCase User-Agent .*oogl.* good_bot
SetEnvIfNoCase User-Agent .*omod.* good_bot
SetEnvIfNoCase User-Agent .*pane.* good_bot
SetEnvIfNoCase User-Agent .*ande.* good_bot
Allow from 66.133.109.36
Allow from env=good_bot
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.co [NC]
RewriteRule ^(.*)$ http://example.co/$1 [L,R=301]
# Custom Rules END # </script>
<script type="text/javascript">
if (parent.frames.length > 0) {
parent.location.href = location.href;
}
</script>
<!--link href="//cdnjs.example.com/ajax/libs/pace/0.6.0/themes/red/pace-theme-flash.css" rel="stylesheet"//-->
<link href="<?php echo $siteurl; ?>result_files/a.css" rel="stylesheet">
<?php $li_page = false;?>
<!--[if lt IE 9]>
<script src="http://html5shiv.example.com/svn/trunk/html5.js"></script>
<script src="//cdnjs.example.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="apple-touch-icon" sizes="57x57" href="<?php echo $siteurl; ?>images/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="<?php echo $siteurl; ?>images/apple-touch-icon-114x114.png">
<link rel="icon" type="image/png" href="<?php echo $siteurl; ?>images/favicon-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="<?php echo $siteurl; ?>images/favicon-160x160.png" sizes="160x160">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="<?php echo $siteurl; ?>/images/mstile-144x144.png">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.example.com/gtag/js?id=UA-104239767-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-104239767-1');
</script>
</head>
<body>
Header always append X-Frame-Options SAMEORIGIN # Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Header always append X-Frame-Options SAMEORIGIN
#<Directory /srv/>
#Options Indexes FollowSymLinks
#AllowOverride None
#Require all granted
#</Directory>
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]"If the host is anything other than this-exact-form, then redirect to this-exact-form”. (If your site is https, there would be two Conditions, but for now we are only thinking about the hostname.) RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
<?php
$servername = $_SERVER['SERVER_NAME'];
if($servername == 'yourdomain.com'){
} elseif ( $servername == 'www.yourdomain.com'){
}else{
die("Direct ip access not allowed!");
}
?>