Learn htaccess hide .htaccess rewriterule flags , syntax using the sample example below.
How to stop someone looking at your htaccess file
One of the first things you want to do is make sure no one tries to look at your .htaccess file. This is actually very easy to do, all you need to do is make use of the Files option.
Just enter the code below to block people seeing your .htaccess file.
# Block people seeing the htaccess file
deny from all
Block access to your .htaccess file
# secure htaccess file
deny from all
# prevent viewing of a specific file
deny from all
# multiple file types
Deny from all
Rename htaccess files
You can also rename your .htaccess file name to something else to prevent access.
The most common place to upload an .htaccess file is the root ie. the home page of your website. This is because so many things can be controlled from the top level. However, there are many occasions when you will need to upload an .htaccess file to a sub directory. For example, if you want to password protect a directory you need to place the .htaccess file in the directory you want to protect.
The important thing to remember is that any code in a subdirectory .htaccess file supercedes the one in the directory above. However, it only supercedes it when there is a clash. I’ll explain this with an example.
Lets say your root .htaccess and your subdirectory .htaccess file both state how a 404 error should be treated. If someone tries to view a page which has been deleted within the subdirectory then the user will be redirected according to the rule stated in the subdirectory .htaccess file ie. it supercedes the htaccess on the home page. If, however, the user tries to view an incorrect url in the root directory, the root .h
taccess file will dictate what will happen.
htaccess hide .htaccess syntax
htaccess hide .htaccess code on this is provided for your study purpose, it will guide you to know how to use mod_rewite to create .htaccess files on the apache servers. use it to practice and train your self online
All the tutorials on this site are free, the page code is provifed for you to use it to practice, if you want to help to improve and maintain this work, you can donate to us on.
Htacess tutorial guides withexamples and easy steps to set ip up on your server.
Htaccess force file save
adding new mime types and set timezone
cache control no cache and cache public
gzip page compression
block all bad robots
redirect www to non www
stop directory listing
block and allow referrer
changing home directory page
file access deny control
password protect a directory
hot to create file
php 301 redirect
custom error page
prevent directory listing
set cookie domain authentication
modifying the environment variable