Redirecting to another URL and passing the correct HTTP headers is extremely useful from SEO point of view if you migrate your website/blog from one URL to another. Other than redirecting to URL you can also use the redirect directive to send certain HTTP status codes when a page is accessed. The Redirect directive can be used in both the httpd.conf file as well as .htaccess file.Continue Reading…
PHP error_log .htaccess
The PHP error_log setting specifies in which file the PHP script errors are logged. This setting is usually specified in the PHP configuration file php.ini which points to a file in which errors of all PHP scripts on that server are logged. It can be modified per directory basis to maintain separate logs for different set of scripts. For users on shared hosting account it is a bonus feature of being able to modify the error_log setting. Normally the error log is a single file for an entire server which is stored in one central place which is only accessible by the root user. But by modifying the error_log setting using htaccess you can have a separate error log for your web hosting account. The php_value error_log requires the php_flag log_errors to be On.Continue Reading…
Redirect http to https using htaccess
Redirect your website from http://www.example.com to https://www.example.com using htaccess file in your Apache web server. It is crucial to collect financial and confidential information from a person through HTTP over SSL to make sure the transactions are secure. A customer cannot be asked to type https in front of the URL each your website is visited. So you can make sure they are automatically redirected to the HTTPS version of the website each time they visit the URL.Continue Reading…
Redirect non www to www
This article explains how to redirect your website from the non www url to the www url but editing the .htaccess file. This is necessary because search engines think that example.com and www.example.com are different websites. But since they both have the same content it might work negatively on the search engine ranking. So it is better to redirect example.com to www.example.com doing so this sends HTTP 301 status code when a search engine (or any user) accesses example.com. The 301 code says the non www domain has been “Moved Permanently” to the www domain. Before proceeding make sure the server has support for mod_rewrite.Continue Reading…
How to use custom php.ini files on shared hosting
The advantages of using php with apache web server are many. The wonderful file named .htaccess makes things easier by allowing the webmaster (thats you!) to play around with many settings which would otherwise need the php.ini to be edited. This is a boon for people having their websites hosted on a shared server. Such people can’t even dream of editing the php.ini file located on their web hosting provider’s server. Thus the concept of custom php.ini was born. Webmasters who have their website hosted on a server with support for custom php.ini can create a php.ini within their directory and provide all the necessary settings they require. But custom php.ini doesn’t work out-of-the-box. This article explains how to use custom php.ini on a shared hosting server.Continue Reading…
Password Protect directories using .htpasswd
Anything uploaded to the document root (www, htdocs, public_html folder) of your web server is visible to the public that is why its always recommended to store confidential information outside the document root. But if you want that information to be accessed by selected people then you need to put it in a directory inside the document root and password protect it. Even thought server side languages like PHP and ASP can be used to handle authentication it can be cumbersome. So the htaccess and htpasswd can be used to simplify the whole process and make your life easier. Lets go step-by-stepContinue Reading…