Go Back   Internet Business Forums > Design & Development

Reply
 
Thread Tools Display Modes
Old 01-01-2006, 02:50 PM   #1 (permalink)
Business Guru
 
Brian Turner's Avatar
 
Join Date: Dec 2003
Location: Near Inverness, Highlands, Scotland
Posts: 7,719
Default Sample htaccess file

Questions about using .htaccess and mod_rewrite have come up a few times here, so I've written this piece:

http://www.platinax.co.uk/52-a-simple-default-htaccess/

and included a basic .htaccess file that should help those on linux servers:

1. Redirect users to use only the www form of their domain
2. Redirect error pages to the site index page

You can find a version to edit yourself here:
http://www.platinax.co.uk/downloads/simple-htaccess.txt

Hope that helps.
__________________
SEO specialist
Brian Turner is offline   Reply With Quote
Old 02-01-2006, 09:49 AM   #2 (permalink)
Senior Member
 
vpssupport's Avatar
 
Join Date: Mar 2005
Location: Bedfordshire
Posts: 155
Default Re: Sample htaccess file

Thanks Brian, I actually understood that article - I have read many over the last few months and they tended to over complicate the issue.
I do have one request, would it be possible for you to provide an example of the mod_rewrite when using a dynamic URL for an ecommerce site. I am sure that there are many out there that would benefit of having a quick tutorial.
__________________
Regards,
Clive Rutherford
www.vitalproductsolutions.co.uk
vpssupport is offline   Reply With Quote
Old 02-01-2006, 12:15 PM   #3 (permalink)
Business Guru
 
Brian Turner's Avatar
 
Join Date: Dec 2003
Location: Near Inverness, Highlands, Scotland
Posts: 7,719
Default Re: Sample htaccess file

mod_rewrite on ecommerce sites tends to be a pretty specialist area, where the required solution tends to require customisation according to the software involved.

I really wouldn't be able to provide mod_rewrite rules for general dynamic links, because not only would it be impossible to apply to most instances, but also there is often a requirement to edit the files in the software in a custom manner as well.

The basic stuff on .htaccess for redirects is about as complex as I can get myself - mod_rewrite for dynamic URLs really is very speciaist, so no wonder it looks complicated. I have someone who works for me in this area, but I really don't understand what he does - only that it works.
__________________
SEO specialist
Brian Turner is offline   Reply With Quote
Old 07-01-2006, 01:01 PM   #4 (permalink)
Member
 
Join Date: Jan 2006
Posts: 30
Default Re: Sample htaccess file

thnx for the .htaccess file !
i wanted to ask u, if u could explain the difference from you're version and this other version?
They both work, but there is a difference in the code they use.
i don't know mayby one i better then the other?

thnx in advance
Attached Files
File Type: txt 1htaccess.txt (113 Bytes, 160 views)
File Type: txt 2htacces.txt (290 Bytes, 145 views)
kaching is offline   Reply With Quote
Old 07-01-2006, 03:08 PM   #5 (permalink)
Business Guru
 
Brian Turner's Avatar
 
Join Date: Dec 2003
Location: Near Inverness, Highlands, Scotland
Posts: 7,719
Default Re: Sample htaccess file

At a glance, it looks like the second directs all users to the non-www form of the site.

Certainly I know there are sites out there that prefer that, and there's nothing wrong with that.

Personally I prefer the www-form simply because a lot of people can more easily make the association, and more likely to add www in their links.

However, the key issue is that of consistency - keeping toone form or the other, and that's simply a matter of personal preference.

Hope that helps.
__________________
SEO specialist
Brian Turner is offline   Reply With Quote
Old 07-01-2006, 04:11 PM   #6 (permalink)
Member
 
Join Date: Jan 2006
Posts: 30
Default Re: Sample htaccess file

Thnx for the quick reply

If i would choose for the non-WWW

what is the difference for me if they link to me with a www in their links. Even if the visitor gets redirect to the non-www it still holds the same value (for link-juice) in googles eyes, right?

Both the htaccess-files redirect to the non-WWW form of the site. But they don't use the same code for it, i thought mayby one is better then the other (even the result is the same)

thnx
kaching is offline   Reply With Quote
Old 07-01-2006, 09:58 PM   #7 (permalink)
Business Guru
 
Brian Turner's Avatar
 
Join Date: Dec 2003
Location: Near Inverness, Highlands, Scotland
Posts: 7,719
Default Re: Sample htaccess file

Well, I'm afraid I wasn't able to look at the first file properly, as I'm on the laptop and I'm having problems with my text editor on it at present.

However, I was able to look at the second version fine, which indeed looks as if it should work to use the non-www form.

Really, it's simply the case of using what works - if you find either code appears to do what's required and uses a 301 redirect, then I can't see any problem between choices.

Hope that helps.
__________________
SEO specialist
Brian Turner is offline   Reply With Quote
Old 07-01-2006, 11:19 PM   #8 (permalink)
Member
 
Join Date: Jan 2006
Posts: 30
Default Re: Sample htaccess file

oki, thnx
kaching is offline   Reply With Quote
Old 25-03-2006, 12:29 PM   #9 (permalink)
Business Guru
 
Brian Turner's Avatar
 
Join Date: Dec 2003
Location: Near Inverness, Highlands, Scotland
Posts: 7,719
Default Re: Sample htaccess file

Just to let you know I've updated this article - originally, I suggested full URLs when setting up redirects to error pages in .htaccess.

However, I've recently discovered that this can lead to the server returning 200 OK headers - in other words, telling search engines that the missing file is actually found - so they'll keep requesting it.

It's important to use relative redirects in .htaccess for this purpose, so I've amended the article for that.
__________________
SEO specialist
Brian Turner is offline   Reply With Quote
Old 19-11-2006, 09:28 PM   #10 (permalink)
Member
 
Join Date: Jan 2006
Posts: 30
Default Re: Sample htaccess file

hi Brain,
I just tested my server header
Quote:
HTTP/1.1 200 OK
Date: Sun, 19 Nov 2006 20:20:03 GMT
Server: Apache
Last-Modified: Fri, 10 Nov 2006 20:25:30 GMT
ETag: "7413f-47ee-4554e03a"
Accept-Ranges: bytes
Content-Length: 18414
Connection: close
Content-Type: text/html
Do i understand you correctly that this isn't good because of the 200 OK ?
I'm using you're example http://www.platinax.co.uk/downloads/simple-htaccess.txt

thnx inadance!
kaching is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


All times are GMT +1. The time now is 08:43 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.