Archive for the .HTACCESS Category

How to redirect a Domain to sub-directories ?

If you want to redirect a  domain to subdirectories  then just add the below code in the .htaccess :

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
RewriteRule    ^$   subdirectory/    [L]
RewriteRule    (.*)  subdirectory/$1 [L]
</IfModule>

This will redirect the domain.com  to domian.com/subdirectory  but when you access the domain in the browser then it will just show domain.com in the browser not  domain.com/subdirectory  .

That’s all  you are done.

Note  :  Replace the domain.com  to  your  domainname .

How to disable website pages download using wget ?

If you want to disable wget to grab your site pages then simply add the code below
in the .htaccess file under public_html directory for which you wish to disable the wget grabbing.

===================================
SetEnvIfNoCase User-Agent “^Wget” bad_bot
<Limit GET POST>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</Limit>

===================================

Now, if anybody tries to grab info from your website using wget, he will receive a 403 error.

That’s all  you are done.

Warning: file() [function.file]: URL file-access is disabled in the server configuration

If you are getting the above error then  make the following changes  in  the php.ini file (Suexec  server) or  .htaccess file (non-Suexec server) :

[email protected][#] vi  php.ini

allow_url_fopen = On
allow_url_include = On

or

[email protected][#] vi  .htaccess

<IfModule mod_php5.c>
php_admin_value allow_url_fopen On
php_admin_value allow_url_include On
</IfModule>

That’s all  this will  do it.