Category Archives: htaccess


Domain redirect

If you wish to redirect domain name i.e if you access abc.con and wich to redirect domain to then you will need to create .htaccess file under document root of domain and add following.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^abc.tld [nc] # Domain to redirect
rewriterule ^(.*)$ http://xyz.tld/$1 [r=301,nc]

Post to Twitter


How to disable mod_security for domain

If mod_security is causing problem in proper functuning of your web site then you will need to disable it by placing few statements into your .htaccesss file. Statement verry depending on your apache server version.

Checking apache version:

[root@server]# httpd -v


[root@server]#/usr/local/apache/bin/httpd -v

If you have apache 1.x then create .htaccess file into your document root and place following statements.
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

If you have apache 2.x then place following statements.
<IfModule mod_security2.c>
SecRuleEngine Off
SecAuditEngine Off
That’s it your are done.

Post to Twitter


Enable/Disable directory listing

If you want list all the file that are present under certen directory then you will need to enabled directory listing that be be done in your .htaccess file as fallows.

1) Edit your .htaccess file and put following code

Options +Indexes

2) save and exit. Now you are done.

All files under testdirectory will be listed into browser.

If you want to disable it then enter following line in .htaccess

Options -Indexes

Post to Twitter