Browsing articles tagged with " .htaccess"
May
7
2009

Force www vs non-www to avoid duplicate content on Google Search

When you have your site accessible both under your_domain.com and www.your_domain.com you may come up with duplicate content on Google Search. To avoid such problems you can use the following lines in your .htaccess file to force only the www version of your web site: RewriteEngine on RewriteCond %{HTTP_HOST} !^www.your_domain.com$ RewriteRule ^(.*)$ http://www.your_domain.com/$1 [R=301] Note that the .htaccess should be located in the web site main folder. This will redirect all requests to the non-www [...]

May
7
2009

Duplicate content fix index.html vs / (slash only)

This similar to the www vs non-www version of your site work-around. As you might now you, by default you can access your site as http://www.domain.com/ and http://www.domain.com/index.html with some setups it can be index.php or index.asp or default.aps, etc. Unfortunately, this creates a risk of duplicate content from the search engine point of view. To avoid this, you can use the following ModRewrite rules in your .htaccess file: RewriteEngine on RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ [...]

May
7
2009

Make PHP to work in your HTML files with .htaccess

By default most web servers across the internet are configured to treat as PHP files only files that end with .php. In case you need to have your HTML files parsed as PHP (e.g .html) or even if you want to take it further and make your PHP files look like ASP, you can do the following: For web servers using PHP as apache module: AddType application/x-httpd-php .html .htm For web servers running PHP as [...]


Domain Registrations starting at $9.98*

Categories

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

EverBot twitter