If you are using smarty in your project, and want to prevent access to template files, add the following lines of code in your .htaccess file of your project.
<files ~ "\.tpl$">
order deny,allow
allow from none
deny from all
</files>
In place of .tpl, if you write .html, all html files are denied access.
If you want to remove .php extension from the url of a page (not the parameters), add this code to your .htaccess file.
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
In this way, a url like http://www.domain.com/page.php will work even if you enter in the url: http://www.domain.com/page
<files ~ "\.tpl$">
order deny,allow
allow from none
deny from all
</files>
In place of .tpl, if you write .html, all html files are denied access.
If you want to remove .php extension from the url of a page (not the parameters), add this code to your .htaccess file.
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
In this way, a url like http://www.domain.com/page.php will work even if you enter in the url: http://www.domain.com/page
Comments
Post a Comment