Archive for May 2010

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 enable or disable custom php.ini on a Su-exec Server ?

If  you want to  disable custom php.ini  settings  on  a Su-exec server  then  make the   below changes in  the suphp.conf  file(/opt/suphp/etc/suphp.conf) :

[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.

application/x-httpd-php=/usr/local/lib/
application/x-httpd-php4=/usr/local/php4/lib/
application/x-httpd-php5=/usr/local/lib/

And if you want to  enable the custom php.ini settings  then  just make the below changes  in  the suphp.conf

[phprc_paths]
;Uncommenting these will force all requests to that handler to use the php.ini
;in the specified directory regardless of suPHP_ConfigPath settings.
;application/x-httpd-php=/usr/local/lib/
;application/x-httpd-php4=/usr/local/php4/lib/
;application/x-httpd-php5=/usr/local/lib/

That’s all you are done.

Note :  Just restart the Apache service  after making the above changes.

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.