Disable suhosin on the server using php.ini or .htaccess files

Sunday, 30. October 2011

If you ever wanted to disable certain Suhosin settings at a domain level, these 2 methods may be of help to you

Disable suhosin Using php.ini file

1) Login to the server as root and copy php.ini file to the root folder of the domain in question. Usually, this command should work for you.

[[email protected]]# cp /usr/local/lib/php.ini /home/<username>/public_html

2) Open the php.ini file and add the following code to the file:

; Misc Options
suhosin.simulation = On
#On = Disabled, Off  = Enabled

3) Save and quit the file. Restart apache.

Disable suhosin Using .htaccess file

1) Locate and open the .htaccess file of the domain in question – possibly via FTP or CMD.

2) Now enter the following code in the file.

php_flag suhosin.simulation On

If suphp is in action on the server, you may also need to add this to your .htaccess.

<Files ".ht*">
deny from all
suPHP_ConfigPath /home/username

4) Save and quit the file. Restart apache.

Enforcing WWW URLs with 301 Redirect using .htaccess file

Friday, 16. September 2011

If you want to enforce www to your URLs or simply redirect everything to a new URL with .htaccess file, this may help you.

1) Open your .htaccess file and look for these lines

Options +FollowSymLinks
RewriteEngine On

2) Underneath these lines:

301 Redirect Everything to new URL

RewriteRule ^(.*)$ http://www.new-domain.co.uk/$1 [R=301,L]

301 enforce WWW to URL

# Everything that does not start with wwww
RewriteCond %{HTTP_HOST}   !^www     [NC]
RewriteRule ^(.*)$          http://www.domain.com/$1  [L,R=301]