Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm using .htaccess with RewriteRule to create SEO-friendly URL's. However, I have a few questions about this:

  1. First of all, I noticed many websites end their URL's with .html (or another extension). For example: http://www.example.com/news/564/seo-improvements.html
    Does ending an URL with an extension have an impact on SEO?

  2. Which URL is the best (again, for SEO):

    http://www.example.com/news/564/seo-improvements.html
    http://www.example.com/news/564-seo-improvements.html

    I've noticed both notations are often being used.

  3. On many websites, I notice you can alter the text part of the URL, which is followed by a redirect. For example:

    http://www.example.com/news/564/seo-improvements.html <-- original URL http://www.example.com/news/564/sefkdjfjdfkdjfk.html <-- altered URL, will redirect to the first one

    How can such a redirect be done?

Thanks

EDIT: When creating this thread, I got a warning this question may be subjective - is it? Isn't there a "correct" answer on these questions?

share|improve this question
    
Re "correct answer": It depends - is there a "correct search engine"? –  Kerrek SB Jul 25 '11 at 12:51
add comment

migrated from stackoverflow.com Jul 25 '11 at 12:54

This question came from our site for professional and enthusiast programmers.

6 Answers

up vote 5 down vote accepted
  1. No difference from SEO perspective. But may be an issue for some people's minds: "Pfew, stone-age html"

  2. No difference at all.

  3. This approach is also used on this site - try for yourself. The important part in URL is an ID which can uniquely identify one URL from another (take this site for example: there can be more than one question with the same title/slug but IDs will be different).

    The logic behind is simple -- check DB is slug matches one on record. If not -- issue 301 redirect to a proper URL.

share|improve this answer
add comment

3) Concerning the redirect

In http://www.example.com/news/564/seo-improvements.html I assume that /seo-improvements.html is just "sugar". All important information is in the http://www.example.com/news/564 part (news and 564).

Therefore, if the news entity with id 564 is found, but the URL does not match the expected slug, one can easily issue a redirect with the correct slug.

(I'm not sure that I applaud this strategy, though.)


As for points 1) and 2), you may find Underscores are now word separators, proclaims Google worth a read. I don't know whether this is (or; was ever) true!:

Matt stated that the number of slashes in your URL (i.e. the number of directories deep your page is) isn't a factor in your Google rankings.

And

According to Matt, the file extension in your URL won't affect your rankings.

share|improve this answer
add comment

The golden rule is that URIs should not change, content should.

  1. In terms of SEO, there isn't much difference, for now at least. The problem with extensions on URIs is that after a while, they become outdated. This is commonly seen with sites that have URIs ending with .cgi, when the backend probably stopped using CGI a long time ago. The same goes for HTML. It's the current standard now, but who's to say that it still will be in years to come. What about XHTML...?

  2. Again, as far as search engines are concerned, there should be no difference. It's often a good idea to have hackable URIs. Given /images/2010/summer, it's handy if the user can hack the URI down to /images/2010 and still get a valid page of images from 2010. Or /images/ and get a valid pages of images. Your example is slightly different, in that 564 is just a unique ID (probably in a database) for a given item. The bit that follows is just a handy human-readable part. Hopefully, hacking it down to /news/564 would return the same thing - perhaps redirecting to /news/564/seo-improvements in the process.

  3. See 2. The back-end app probably doesn't care about the bit after 564.

For more information, see:

Cool URIs don't change
Cool URIs for the Semantic Web

share|improve this answer
add comment

It all depends on the indexer, for example google or bing might have different algorithms. It doesn'n really matter what your pages' extensions are. The names http://www.example.com/news/564/seo-improvements.html http://www.example.com/news/564-seo-improvements.html will probably behave the same. You can do a redirect with javascript, put the following code in the page you want to redirect from.

<script type="text/javascript">
document.location = "otherurl";
</script>
share|improve this answer
add comment

My general approach to SEO is to setup my site in the way that's makes the most sense for my visitors first, but also works for ranking well on search engines. When it comes to URLs and search engines, they'll be able to index your site as long as you have a unique URL.

To answer your first question, search engines may not care if you end your pages with an extension like .html, but I think it makes it easier for visitors to know a link is for a webpage (and not a directory or file) if it ends in .html. Plus, Matt Cutts suggested keeping file extensions such as .html for this reason (Matt Cutts interview from GoogleWebmaster YouTube Channel). He's not saying there's a penalty for not using extensions, but given how few "real" answers are released from search engines around SEO I prefer to follow his advice.

For question two, I don't see any SEO difference in those URLs. Go with the one you think looks best.

Question 3, this is can be done with a simple 301 redirect.

share|improve this answer
add comment

1) you can trim .html

2) second case maybe better cause / separes phrase in path, but we speak about microscopic factor

3) if you use redirect 301 near 100% of rank goes to destination page

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.