If you have noticed that time on your website is not what you would expect and want to change it, there are several options. Most shared hosting providers are restricting access to php.ini file, but you can still change the timezone on your website using the .htaccess file.
What you’ll need
Before you begin this guide you’ll need the following:
- Access to hosting control panel or FTP account
Step 1 — Opening up your .htaccess file.
.htaccess file is located in your public_html directory. You can open it up using File Manager in your hosting account’s control panel or by connecting to your account via FTP Client (FileZilla, for example). The following tutorials describe both methods in detail:
Step 2 — Finding the correct timezone
You can check a list of all supported time zones at this website.
Firstly select your region.
Now select a timezone that you want to be used on your website. In our example, we have chosen America/Chicago.
Step 3 — Setting timezone via .htaccess file
Once you know what format your timezone should be in, navigate to your .htaccess file. After that, enter the following code at the very top of your .htaccess code:
php_value date.timezone 'America/Chicago'
IMPORTANT! Instead of
America/Chicago, you would need to use your chosen timezone.
After the timezone code is entered, don’t forget to Save the changes you have made.
Congratulations, you have successfully changed the time zone of your website!
This quick tutorial shows how to change the default time zone on your website with the help of .htaccess file.