Zainab Amin

4 .htaccess Hack Every Blogger Must Know


Hyper-text Access or commonly know as .htaccess, is a simple yet powerful configuration file which is used to control the directories it is placed in. This file is used to control many aspects of the website and how works.

In this I will be explaining 4.htaccess Hack Every Blogger Must Know. 


Implementing 301 Redirect

If you have changed the URL structure of your website either due to the change of your CMS or any other reason, you will need to implement 301 redirection from your old URL to the new one.

Syntax for 301 redirect is
Redirect 301 relative/path/to/oldurl/ http://www.domain.com/newurl/

The first URL should be a relative path to the old URL and the second one should be an absolute path to the new URL.


Only allow specific IP addresses in certain directories
This is especially useful for admin directories, Unlike other .htaccess hacks, this one doesn’t work from the root folder. You will need to create a new .htaccess file, put the following code in it, and upload it to your admin directory (that’s wp-admin if you’re using WordPress).

order deny, allow
deny from all
allow from xx.xx.xx.xx

Disable Directory Browsing
If you want to keep people out of certain directories that may highlight the security weakness in your website because of plugins etc, use this hack to prevent users to browse your directories.

Options All -Indexes

Set a Custom 404 Page with htaccess
Just change ‘/notfound.html’ to match the path to your custom 404 page.

ErrorDocument 404 /notfound.html
- See more at: http://www.devilscafe.in/2014/02/4-htaccess-hack-every-blogger-must-know.html#sthash.9RppRbl3.dpuf


ADVERTISEMENT
Subscribe to this Blog via Email :

Would love to here from you...