Category Archives: Blog

How to create Password protected website on Apache in Centos 6

1. Create website and check if it is accessible via browser. Once confirmed that your website is working, proceed to step 2.

2. Create a htpasswd file in /etc/httpd/conf/
[root@mac1 conf]# htpasswd -c .htpasswd admin
New password:
Re-type new password:
Adding password for user admin

3. Set .htpasswd file permission 0644 so that it is accessed to Apache user and group of Apache server.
chmod 0644 .htpasswd

4. Now create .htaccess file in your document root where the website is placed (/var/www/html/)
#vim /var/www/html/.htaccess
Paste the following lines in this file
AuthType Basic
AuthName “Restricted Area”
AuthUserFile /etc/httpd/conf/.htpasswd                (path of htpasswd file)
require valid-user

5. Set permission 0644 to this file so that it is access to Apache user and group.
[root@mac1 conf]# chmod 0644 /var/www/html/.htaccess

6. Now open httpd.conf file and paste the following lines in your Virutal host
<Directory “/var/www/html”>                                  (path of your document root)
AllowOverride AuthConfig
Order allow,deny
Allow from all

7. Restart the Apache web server. Execute the command below
Service httpd restart

Google Analytics: Malformed Request, The Site Has Not Been Registered

Today while adding Google Analytics to my site, I encountered a serious problem wherein Google was not granting access. It was constantly throwing following error:

The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows: The site “http://www.xyz.com”

As a matter of fact anyone who wants to pull data from Google applications (contacts, calendar, web statistics, etc) needs to first be granted permission to do so by the user who owns or has legitimate access to that data. Google originally built its own “Google Authentication Service” to accomplish this, and has also recently adopted the open API authorization protocol OAuth. Continue reading

Disable WordPress Autosave Post Revision

When writing or editing your posts and pages on WordPress powered blog, the changes you make are automatically saved every seconds. Autosaves are enabled for all posts and pages but do not overwrite published content. Autosaves are stored as a special type of revision; they do not overwrite the actual post. The feature can’t be turned off from the Admin interface of WordPress, however you can disable Continue reading

How to generate dynamic sitemap and submit to Google, Yahoo, Bing and Ask

As demand for search engine optimized website are increasing day by day, importance of sitemaps can not be ignored.

What are Sitemaps?
Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site. Continue reading

ASP.NET currency converter using foxrate.org XML-RPC API

Abstract: In this article I will guide you through the process of creating simple currency converter using Foxrate.com XML RPC API. This API is free to use. There a few examples available in programming languages such as Python, PHP or RoR, however in ASP.NET C# its the first.

What we need: In order to connect to the XML-RPC API, you will need an XML-RPC client. First of all add latest version of “CookComputing.XmlRpc” to your project. I have used ver 2.5 in my project, since it has some bug fixed related to permission and security when running on live server. Continue reading