Force SSL/https using .htaccess and mod_rewrite
Sometimes you may need to make sure that the user is browsing your site over securte connection. An easy to way to always redirect the user to secure connection (https://) can be accomplished with a .htaccess file containing the following lines:
(more…)
Restrict access to your website
It is also highly encouraged to restrict access to your website while repairing the database or making upgrade. Here is an example of restricting your website instance to your IP address exclusively. Other visitors, including search spiders, will get the HTTP 503 Service Unavailable error.
(more…)
Allow your IP only to access a site
add this code on your .htaccess file where xxx.xxx.xxx.xxx is your ip address
Change default directory page
Most probably you have been wondering how the Webserver decides which page from your site to use as a main/default page of your site. There is a directive named DirectoryIndex…
Prevent Script Execution
You can disable scripts being run in the directory of your choice by adding the following code to your .htaccess file in that directory: You can replace the file types…
How do I block direct access to critical files using .htaccess?
Critical files, Let say configuration.php file for Joomla 1. Make a backup copy of your .htaccess file. Use your backup file to recover if the following fails. Be sure to…
Magic Trick: Allow/Prevent Directory Browsing
Most servers are configured so that directory browsing is not allowed, that is if people enter the URL to a directory that does not contain an index file they will not see the contents of the directory but will instead get an error message. If your site is not configured this way you can prevent directory browsing by adding this simple line to your .htaccess file:
(more…)