I've been trying to make a model/view structure for a website (or the aedrin's method
), so my root directory structure is
RewriteRule ^([^/\.]+)(/*)([^/\.]*)$ index.php?page=$1&rest=$3 [L]
in my htaccess, which will convert all links like /about
and so on.
And my index.php contains
if($page=="" || $page=="index.php")
The above code also
works for /download/file1
to download a file named file1
(I've the required code in /model/download.php
Now, this setup works fine for all
type links, which will show a text in the
<p> Sorry, the requested page is not found in site. In case, if you have followed a valid link,
please <a href="
/contact_webmaster/page=blah-blah&rest=">let know the Majlis webmaster</a>.
and thus I can
catch the requested url
in my contact_webmaster
Now my question are
- Can I catch requests (by modifying htaccess) like
/blah.blah etc.(currently showing an apache 404 error) in my index.php and pass through the rest of codes?
- How can I restrict request like /model/about.php,
/view/about.php etc. which is currently displaying a php error or some html with no styles
Hope my questions are clear.
After all sorry for this huge post and thank you for reading the same (I've no other way to explain)