Anything written after index.php?page= loads website not causing 404 error
<p>I have dynamic website based on HTML with PHP. I use index.php as layout file.
To load a subpage (ex. contact or news) i use url index.php?page=contact or index.php?page=news. That works without problem.</p>

<p>Problem is when user write anything after index.php?page= (index.php?page=anything). This should execute 404 error but loads website without content (only layout file). How to manage that?</p>

<p>I use .htaccess to make friendly links, so all my urls looks like <a href="http://mywebsite.com/contat" rel="nofollow">http://mywebsite.com/contat</a> instead of <a href="http://mywebsite.com/index.php?page=contact" rel="nofollow">http://mywebsite.com/index.php?page=contact</a>.</p>

<p>Code fragment for index.php:</p>

<pre><code>&lt;div id="links"&gt;
&lt;hr class="line" size="1"&gt;
&lt;a class="link1" href="/news"&gt;NEWS&lt;/a&gt;
&lt;a class="link1" href="/technical-info"&gt;TECHNICAL INFO&lt;/a&gt;
&lt;a class="link1" href="/entry-system"&gt;ENTRY SYSTEM&lt;/a&gt;
&lt;a class="link1" href="/starting-list"&gt;STARTING LIST&lt;/a&gt;
&lt;a class="link1" href="/results"&gt;RESULTS&lt;/a&gt;
&lt;a class="link1" href="/contact"&gt;CONTACT&lt;/a&gt;
&lt;/div&gt;

&lt;div id="content"&gt;
&lt;hr class="line" size="1"&gt;
&lt;div style="margin-left: 35px; margin-right: 35px;"&gt;
&lt;?php
if(empty($_GET['page']) or $_GET['page']=='news'){
include("news.php");
}
if($_GET['page']=="technical-info"){
include("technical-info.php");
}
if($_GET['page']=="entry-system"){
include("entry-system.php");
}
if($_GET['page']=="starting-list"){
include("starting-list.php");
}
if($_GET['page']=="contact"){
include("contact.php");
}
if($_GET['page']=="results"){
include("results.php");
}
if($_GET['page']=="add-entry"){
include("entrysystem/add-entry.php");
}
?&gt;
&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>.htaccess code:</p>

<pre><code>Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(news)/?$ index.php?page=$1 [L]
RewriteRule ^(technical-info)/?$ index.php?page=$1 [L]
RewriteRule ^(entry-system)/?$ index.php?page=$1 [L]
RewriteRule ^(starting-list)/?$ index.php?page=$1 [L]
RewriteRule ^(results)/?$ index.php?page=$1 [L]
RewriteRule ^(contact)/?$ index.php?page=$1 [L]
RewriteRule ^(add-entry)/?$ index.php?page=$1 [L]
</code></pre>