Tag Archives: .htaccess

Force secure browsing https

RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} dir RewriteRule ^(.*)$ https://www.example.com/dir/$1 [R,L]

Posted in Uncategorized | Tagged , | Leave a comment

Prohibit execution of PHP scripts inside include directory

Create a PHP file /** * prepend_goto_index.php */ header(‘Location: http://’ . $_SERVER['HTTP_HOST']); Inside the include directory, create .htaccess file php_value auto_prepend_file prepend_goto_index.php

Posted in PHP | Tagged , | Leave a comment

Disable PHP in directory

In .htaccess php_flag engine off

Posted in Apache2, PHP | Tagged , | Leave a comment

Showing PHP errors

On production environment, you sometimes need to display errors temporarily to see what’s going wrong.  Without the need to modify php.ini, you can add this to .htaccess file on the particular web folder you are working on. php_flag display_errors On … Continue reading

Posted in Apache2 | Tagged | Leave a comment

How to use .htaccess to change default index page

DirectoryIndex alternative-default-home-page.php

Posted in Apache2, Linux Administration, Programming | Tagged | Leave a comment