Thursday, August 16, 2012

HTACCESS File uses some important tips.

1) You just put on root .htaccess file.below this line.

Options -Indexes

2) Redirect url with www .

use below this code.

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

3) Redirect http://www.example.com/home.html , http://www.example.com/index.php to redirect http://www.example.com/ this url. Using below code is very useful.

RewriteRule ^home\.html/?$ http://www.example.com/ [NC,R,L]
RewriteRule ^index\.php/?$ http://www.example.com/ [NC,R,L]
RewriteRule ^index\.php/home\.html/?$ http://www.example.com/ [NC,R,L]

4) Allowed some folders files only.other folders called redirect codeigniter controller.below this code use for
remove index.php in codeigniter.put this code .htacess

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]







No comments:

Post a Comment