-1

I've been trying to do some research for whether or not I should include file extensions in my url paths in my website (and whether or not it is detrimental to use relative urls).

Among some of the sites I have visited for this research are listed below:

http://css-tricks.com/snippets/htaccess/remove-file-extention-from-urls/

http://www.seo-theory.com/2011/11/30/how-do-pretty-urls-help-search-engine-optimization/

However, none of them have really answered my questions.

As for whether or not to include file extensions:

Assuming that all of the links are NOT broken, and I have constructed them properly, are there any downfalls to linking to other pages within my site and including the file extension? Originally, I thought I should include them just for specificity's sake, but now I know it doesn't make as pretty of a url.

Does this effect SEO greatly?

Should I go back and erase all .cshtml, .jpg, etc. from my url paths? Should I include this removal from the tags that link to my .js and .css external files?

If it matters, the context of this question is coming from a C#.net WebMatrix environment.

VoidKing
  • 6,282
  • 9
  • 49
  • 81

1 Answers1

1

You can erase the .cshtml part of your urls if you like (I generally do) but you should not erase the extensions of images, style sheets, JavaScript files etc. The .cshtml files will be found by the Web Pages framework through its rudimentary routing system, but that only applies to .cshtml and .vbhtml files. If you remove the extensions from other types of file, they will not be found. And in any event, it would be pointless. It's not as if you want Google to index your .css file (which it doesn't).

As to whether removing the .cshtml extension will affect SEO - no, it will make no difference. If it did, you would easily be able to find a lot of advice to that effect.

Mike Brind
  • 28,238
  • 6
  • 56
  • 88
  • Thanks for the advice, Mike. I may not understand you correctly when you say, `"And in any event, it would be pointless. It's not as if you want Google to index your .css file (which it doesn't)."` Am I to understand that omitting the file extensions on files in my site (i.e. `.cshtml`) allows those files to be indexed? If so, wouldn't I want to omit the `.cshtml` from all of my web pages, then? Again, I may not have understood you correctly. – VoidKing Jun 12 '13 at 15:10
  • Sorry - to clarify: Google doesn't index "files". It indexes resources. These are identified by URLs, which may or may not include a file extension. Google doesn't care either way. Google doesn't, to my knowledge, index css or js files. – Mike Brind Jun 12 '13 at 16:01
  • Okay, thanks for clarifying :) Also, I (or rather the organization I work for) purchased your book last week and should receive it soon. I figured it would be a good idea after reviewing it and seeing that you included jQuery and SQL in it. This way, if I get into an accident (heaven forbid) or something, anyone trying to manage our web apps and website will have a good reference, especially considering that the C#.net webpages environment is certainly not the most common (even if I, personally, love it). – VoidKing Jun 12 '13 at 17:57