Mobile app version of vmapp.org
Login or Join
Megan663

: SEO: do we need to redirect also pages with final slash? i read on Google SEO REPORT CARD that for search engines this page: http://www.domain.com/somepath is a different page than this one:

@Megan663

Posted in: #Seo #Url #UrlRewriting

i read on Google SEO REPORT CARD that for search engines this page:
www.domain.com/somepath
is a different page than this one:
www.domain.com/somepath/ (note the final slash '/')

Well if this is true i have few questions:



A) Is this true also for home page path i.e. www.domain.com.
I mean I already redirect 301 domain.com to www.domain.com, but how do I redirect also www.domain.com to www.domain.com/ (with final slash) ???
Actually Apache server or my browser client (don't know who is doing this) seem to already do this sort of redirect becasue if I insert www.domain.com in browser bar it always auto adds the final slash making it www.domain.com/
So I'm confused, do I need to do anything?



B) Since I still use file extensions, I was not so concerned about redirecting domain.com/somepath to domain.com/somepath/ because all pages in my sites are in the form of somepath/page.htm.

But I noticed anyway a strange thing that is confusing me. If I enter as URL somepath/page.htm the server returns the same page of somepath/page.htm/ (with final slash) instead of an error.
I think it's normal because if you look for www.php.net/docs.php it returns the same page of www.php.net/docs.php/ (final slash), but are these then considered TWO different pages for search engines???

Do I have then to adjust again .htacess in order to redirect 301 each URL with final slash to the same url without the final slash???



Thanks!

10.06% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

6 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

Trailing slashes on the domain name are treated exactly the same as no trailing slash, i.e. www.domain.com = www.domain.com/.
But that's the only exception. Any other time the URL differs, it can return completely different content and thus is treated as a different URL.

Any file returned (with an extension like .htm or .php) should not have a trailing slash. You will find on the Apache server that trailing slashes are usually ignored and the file is returned. This is just how Apache works; the URL example.com/file.php/abc/xyz will go back to file.php, assuming there is no actual file or folder structure like the above.

Directories generally have trailing slashes - again, Apache will automatically 301 redirect to them. For example if you have a folder hello then example.com/hello should redirect to example.com/hello/.

10% popularity Vote Up Vote Down


 

@Hamaas447

URLs without the slash are treated as different to URLs with the slash, so in SEO terms, whatever you do, be consistent.

Should you have a slash or not? Of course you should, particularly when dealing with sub-folders.

When requesting example.com/foo, the server will first have to look for a resource call foo; when it doesn't find it, it will usually then look for a directory called foo, and if it finds it, it will return the default document.

When requesting example.com/foo/, the server knows straight away that foo is a directory, and therefore zeroes in on the default document for that folder.

It's a minor efficiency, but every little helps, IMHO.

See:

www.alistapart.com/articles/slashforward/ http://www.davidroessli.com/logs/2007/06/watch_that_trailing_slash/ sebastians-pamphlets.com/thou-must-not-steal-the-trailing-slash-from-my-urls/

10% popularity Vote Up Vote Down


 

@Mendez628

Redirecting to remove the slash is in my opinion the best option, when people link to your site they do it one of two ways, they type out the URL manually in which case they are unlikely to include the trailing slash or they copy and paste in which case the trailing slash would be included, so if you leave the trailing slash up you're likely splitting your links between two URLs (It seems like Google would be sophisticated enough to recognize the two pages are the same, but it's an easy fix so better to be safe then sorry).

If you can't get access to your .htaccess file or redirect these another way then you can use the canonical tag, but it should really be a last resort as it's always better to get your code right then it is to cover it with band-aids.

10% popularity Vote Up Vote Down


 

@Turnbaugh106

You can also use the rel=canonical tag to suggest to google the proper URL for their index.

10% popularity Vote Up Vote Down


 

@Chiappetta492

Anytime there is a difference in any part of the URL, even if it is capitalization or parameter order, search engines will view it as a unique URL.

A) Yes, they are still different URLs, even if it's the domain. You might find the following code useful for your .htaccess file:
#change RewriteBase to / after transfer
RewriteBase /
#Redirects non-www to www
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) www.domain.com/ [R=301,L]


B) These are considered different URLs, but you shouldn't be using a trailing slash directly after a file extension even if the browser still interprets it correctly. I don't think I have ever seen a slash directly after a file extension, so I wouldn't worry about it too much unless you yourself are linking to your pages that way. Don't use the slash after the extension.

In general, stay consistent with your URL schemes. Pick one way and stick with it.

10% popularity Vote Up Vote Down


 

@Lee4591628

According to Google SEO Guide, and also common sense, website paths resembles to a directory structure.

So, trailing slash denotes some folder root. Power users will also attempt to do the following:


user enters through domain.com/articles/2009/nice-shoes.htm user will delete last piece to get into a directory listing, like domain.com/articles/2009/, hoping to see all articles from 2009.


Adjusting your URLs according to this, will let an hierarchy more clear to crawl and index.

You can make this correction with .htaccess mod_rewrite for both, add or remove trailing slash, according to your needs. Check:
www.google.com/search?q=htaccess+removing+trailing+slash www.google.com/search?q=htaccess+adding+trailing+slash
Hope this helps.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme