Change PHP variables using .htaccess
If you need to change the way your PHP is working you can do that using .htaccess.
Please, note that not all PHP options can be changed using .htaccess.
A list of options that can be changed using .htaccess file can be found at:
The ones that can be changed with .htaccess are the ones marked with: PHP_INI_PERDIR or PHP_INI_ALL. The ones marked as PHP_INI_SYSTEM cannot be changed via .htaccess files.
The syntax is pretty simple:
php_flag [variable_name] [value]
For example if you need to turn off register_globals:
php_flag register_globals off
If you need to change the PHP include path:
php_value include_path ".:/usr/local/lib/php:/your_include/path"
The include_path string starts with a dot “.” And then each additional path is separated with a semi colon. (e.g. .:/path1:/path2:/path3)
- How to block users from accessing your site based on their IP address
- How to prevent or allow directory listing?
- How to change the error documents – 404 Page Not Found, etc
- Using .htaccess for password protecting your folders
- Using .htaccess to block referrer spam
- Disable Hot-Linking of images and other files
- Redirect URLs using .htaccess
- Introduction to mod_rewrite and some basic examples
- Force SSL/https using .htaccess and mod_rewrite
- 301 Permanent redirects for parked domain names
- Enable CGI, SSI with .htaccess
- How to add Mime-Types using .htaccess
- Change default directory page
- Block Bad robots, spiders, crawlers and harvesters
- Make PHP to work in your HTML files with .htacess
- Change PHP variables using .htaccess
- HTTP Authentication with PHP running as CGI/SuExec
- Force www vs non-www to avoid duplicate content on Google
- Duplicate content fix index.html vs / (slash only)
Comments 9 >>
|Previous: Make PHP to work in your HTML files with .htacess||Next: HTTP Authentication with PHP running as CGI/SuExec|
Back to Web Hosting Articles list