I just started learning about .htaccess , and i can't seem to understand how to redirect to a url ,when the current url doesn't contain something in it and/or is not like it suppose to be.
For example:
Someone is trying to access www.example.com/contact.php . But my htaccess says that every url that is not www.example.com or doesn't contain '?page='(www.example.com/index.php?page=contact.php) , should be changed into www.example.com .
Also this checking must be before this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
So whenever , the user types example.com , it will be redirected to www.example.com . In case it writes example.com/contact.php or www.example.com/contact.php , it will be redirected to www.example.com , because it is not www.example.com neither contains '?page=' .
www.example.comif the host is notwww.example.com. The resource/index.phpis different from the host addresscontact.phpfor example), and if not, redirect to the homepage?