Archive

Archive for the ‘.htaccess’ Category

Deny visitors by IP address using .htaccess

January 28th, 2010 Ashesh No comments

The visitor blocking facilities offered by the Apache Web Server enable us to deny access to specific visitors, or allow access to specific visitors. This is extremely useful for blocking unwanted visitors, or to only allow the web site owner access to certain sections of the web site, such as an administration area.To set-up visitors restrictions and blocking, create a .htaccess file following the main instructions and guidance which includes the following text: Read more…

.htaccess redirect

January 9th, 2010 Ashesh No comments

The Redirect directive maps an old URL into a new one. The new URL is returned to the client which attempts to fetch it again with the new address.

I only just discovered today how easy, useful and effective .htaccess Redirects are. Here is the code in its purist form:
Redirect file.html http://your.url/file2.html Read more...

Categories: .htaccess Tags:

How do I redirect all links for www.domain.com to domain.com ?

January 9th, 2010 Ashesh No comments

Description of the problem:

Your website can be accessed with www.domain.com and domain.com. Since Google penalizes this due to duplicated content reasons, you have to stick your domain to either www.domain.com or domain.com.
But – since some links are outside of your website scope and the search engines already have indexed your website under both addresses, you can’t change that easily. Read more…

Categories: .htaccess Tags:

Guide to htaccess and mod_rewrite

January 9th, 2010 Ashesh No comments

Canonicalization

The easiest htaccess trick is to make sure that your site doesn’t have any canonicalization issues on the homepage.

A lot of websites suffer from poor search engine rankings by having a number of different versions of the homepage, for example:

http://www.yoursite.com

http://yoursite.com

http://www.yoursite.com/index.html

http://yoursite.com/index.html

These pages are all seen as different urls, despite them having exactly the same content in most cases. Google has got better at deciding which version to use over the past 12 months but you can still run into problems.

To solve this issue simply add the following to your htaccess file: Read more…

Categories: .htaccess Tags:

Protecting email address with .htaccess

November 21st, 2009 Ashesh 1 comment

I hate spam, i received since i created my first email account and i am always interested in web development tricks and techniques for protecting email accounts. Recently i read book about email security and found there very interesting technique which allows users to send email to you while proveiding email harvester with completely false email address, i created variation of this trick which i will share here as well.

First method requires, to create a new fail let’s call it my_false_email@not_exisiting.com, if you are unsure then: YES, file should be named like a valid email address, any UNIX system should handle such file. Next thing we need to do is add following lines in .htaccess file: Read more…

Beginners guide to .htaccess file with examples – Part II

October 28th, 2009 Ashesh No comments

I hope you have gone through the examples listed in first part of this tutorial. If not, it’s here – [Beginners guide to .htaccess file with examples].

In this part, we will cover more examples with .htaccess file.

Presenting custom error pages

Use .htaccess file to present users with your custom pages for 401 [Authorization Required], 403 [Forbidden], 404 [not found] and 500 [Internal Server Error]. Read more…

Categories: .htaccess Tags:

Beginners Guide to .htaccess File with Examples

October 28th, 2009 Ashesh 3 comments

htaccess file allow us to make configuration changes on a per-directory basis. htaccess file works in Apache Web Server on both Linux/Unix and Windows operating system. This article has some basic .htaccess examples, such as htaccess redirect, to get you started with .htaccess right away. Just copy and paste the lines mentioned in this post below, with or without any modification, in your .htaccess file and it should work.

There are several things that developers, site owners and webmasters can do by using .htaccess file. Let’s look at some of them: Read more…

Categories: .htaccess Tags:

Hide .php extension with url rewriting using .htaccess

October 9th, 2009 Ashesh 1 comment

In this post I’m going to show you how to rewrite the URL instead of renaming the file extension Using this technique you will see product.html in the address bar of the browser but the actual file name remains product.php and you don’t need to rename the file extension. Furthermore you can rewrite the URL like product.php?id=5 to product-5.html.

what is the benefits of rewriting URL?

When a search engine visits the dynamic url like product.php?id=5 it does not give much importance to that URL as search engine sees “?” sign treat it as a url which keeps on changing. so we’re converting the dynamic URL like the product.php?id=5 to static url format like product-5.html. We’ll rewrite the url in such a way that in browser’s address bar it will display as a product-5.html but it actually calls the file product.php?id=5. So that why these kind of URL also named as SEO friendly URL.

Read more…

Categories: .htaccess, General, Php Tags:
Get Adobe Flash playerPlugin by wpburn.com wordpress themes