title: Allow requests to .php pages only from Project .php files
body: <p>I want my application to allow pages to be accessed / referenced only from the application pages rather than from external addresses. with the exception of the main(index.php) page that will serve as access to the application. So for example if i  build an html file in my desktop with a link or form to the destination of the application pages i want it to redirect to index.php. <br>
  How can i do this?
  I tried to add this rows .htaccess </p>
  
  <pre><code>Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1
  Allow from ::1
  &lt;Files /index.php&gt;
      Order Allow,Deny
      Allow from all
  &lt;/Files&gt;
  &lt;FilesMatch ".*\.(css|js)$"&gt;
      Order Allow,Deny
      Allow from all
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p>But this didn't work because the desktop file was still in my server .
  <strong>Edit 2:</strong>
  I edited the .htaccess file to this and now it works</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC] 
  RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC] 
  RewriteCond $1 !^(index\.php)
  RewriteRule ^(.*)$ http://localhost/website/index.php [R,L]
  </code></pre>