title: Block everyone, except visitors from specific referrer with htaccess
body: <p>In htaccess, how can i block every visitor except those who come from a specific domain</p>
  <p>i tried this but without any success :</p>
  <pre><code># serve everyone from specific-domain or specific-user-agent 
  RewriteCond %{HTTP_REFERER} ^https?://www.specific-domain.com 
  RewriteRule ^ - [L]
      
      # everybody else receives a forbidden 
      RewriteRule ^ - [F]
      
      ErrorDocument 403 /forbidden.html
  </code></pre>
  <p>Update : i had certain success with below code BUT it broked my webpage certainly because of the following parameters that overrride or disturbe appearance. if someone has a clue how to order it the good way ?</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteCond %{HTTP_REFERER} ^https://authorizedreferer.com
  RewriteRule ^ - [L]
  RewriteRule ^ https://unprotected.mydomain.com/ [R,L]
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  </code></pre>