September 2013 - Webx Networks

How to redirect all traffic to one domain URL via mod_rewrite?

Normally when a website is hosted, both the domain and the prefix www with it load the same website. This can sometimes cause problem as web pages can be accessed using two URLs (e.g. and

Using mod_rewrite rules you can redirect all traffic to one domain. This is also beneficial for SEO (Search Engine Optimization) purpose to avoid duplicate URLs and pages in search engine index. Search engines are becoming smart, however they still may not like duplicate pages.

To be on the safe side and to show only one URL of your website, you can use following format of mod_rewrite rules under Apache web server in .htaccess file which is placed in your web root (typically in public_html).

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

This will redirect all traffic to one URL for all pages on your web site and there will be no duplicate URLs because of www. If you do not want to use www and instead prefer to use only, you can use this instead:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

If you have other mod_rewrite rules, placing one of the rules-set above at the top will process it first and in the next pass it will by-pass them as the URL will not match again.

I am unable to reach my server / account / web site?

If you are unable to reach your website for more than a few minutes (while other websites are working fine from your computer), then it is most probably a network problem between your computer and the server. There can be several reasons for this issue e.g. firewall on the server may have blocked your access, there may be a network issue between your Internet service provider and web hosting server. To find out if this is the case, please follow these two steps:

Step 1

Run a traceroute. This can be done by going to Command Prompt on Windows computer using these steps:

Click Start > Select All Programs > Select Accessories > And then lastly select Command Prompt

Once there, enter this command:


[ where YOUR_DOMAIN_COM is your website domain name hosted on the server. Do not start with http:// – only enter the domain name part without any space in the name. ]

Once the tracert command completes, click on the top left corner of the Command Prompt window, select Edit and then Mark. Now highlight the entire output from the tracert command with the mouse by dragging it on the window from one corner to the other. Once highlight, press Enter key. Now you have the output in your clipboard. Please paste it in a support ticket.

Step 2 (optional)

We also need your public Internet IP address. We normally receive it when you open a support ticket, therefore this step is optional. If you want to provide this information as well, you can go to website and type this in search: What is my IP address?

The search result will show Your public IP address is …

Please copy/paste that into support ticket as well. With this information our support team can quickly troubleshoot the issue and find out why you are unable to open your website or reach the server.

Time not displaying correctly in cPanel webmail (SquirrelMail)?

It was found that the server timezone was set correctly and time was synchronized with an NTP (network time protocol) server, however it was not displaying correctly for clients when they logged into cPanel webmail, specifically SquirrelMail that shows the time in the top left corner. It was off by an hour (indicating a timezone difference in calculation somewhere).

SquirrelMail says that this issue is not in the code but whatever the underlying php provides is displayed there. The reason was that cPanel’s php engine was not calculating the timezone correctly. To fix this issue, edit the php.ini file located at


Uncomment the line that starts with date.timezone:

date.timezone = "TIMEZONE"

And replace the TIMEZONE in above line from one of the supported timezone settings in php documentation e.g. “Australia/Sydney”. And enclose the string in quotes. Save the file and refresh the webmail interface to view correct time.

Back to Top

© 2022 Webx Networks.