Welcome to WebmasterWorld Guest from 23.22.182.29

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

My .htaccess file works but will it help me avoid duplicate content

     
2:35 pm on Mar 1, 2012 (gmt 0)

New User

joined:Feb 23, 2012
posts: 17
votes: 0


Hi All,

Here is a rewrite that works for extensionless urls and add the trailing slash. My 2 question are

1. will this also avoid duplicate content?

2. Also how do I test and see if there is any duplicate content?

Am I doing this correctly when all I want to do is write nice looking url's

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.html
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

Thanks in advance for an help
4:46 pm on Mar 1, 2012 (gmt 0)

New User

joined:Mar 1, 2012
posts:1
votes: 0


Why do you think this should eliminate duplicate content? Maybe it would be helpful if you could explain what you want to do.

Regards

Peter

[edited by: eelixduppy at 10:07 pm (utc) on Mar 1, 2012]
[edit reason] no personal urls, please [/edit]

5:20 pm on Mar 1, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Add the [L] flag to every RewriteRule.

Change the order so that redirecting RewriteRules are listed before those that internally rewrite.

For redirecting rules, add the protocol and hostname to the rule target.

Add a blank line after every RewriteRule for code clarity.

URLs for pages should not end with a trailing slash. Your redirecting rule should have a RewriteCond looking at THE_REQUEST instead of REQUEST_URI. This will prevent an infinite redirect-rewrite loop.
9:24 pm on Mar 1, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12704
votes: 244


For redirecting rules, add the protocol and hostname to the rule target.

... especially if part of your goal is to eliminate Duplicate Content. Otherwise, people who arrive asking for www.example.com will end up getting www.example.com; people who ask for example.com will get example.com; sneaky people who ask for example.com:80 will walk away with example.com:80 and so on.

For "people" read "search engines" and there's your duplication.
11:08 pm on Mar 1, 2012 (gmt 0)

New User

joined:Feb 23, 2012
posts: 17
votes: 0


Thanks All

@Peterz. I dont have any that I know of I just dont want to create any.

@g1smd What is the [L] Flag? I think you understand what Im trying to do. Could you please post a example of what you mean?
11:10 pm on Mar 1, 2012 (gmt 0)

New User

joined:Feb 23, 2012
posts: 17
votes: 0


@lucy Im not sue I understand "add the protocol and hostname to the rule target." or "For "people" read "search engines" and there's your duplication. "

Im not really knowledgebale on this subject. I am a web designer but when to comes to apace servers (or any servers) Im a complete novice.
11:11 pm on Mar 1, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


[google.com...] ... site:webmasterworld.com/apache RewriteRule [L]
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members