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):


    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?


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?

  • Re "correct answer": It depends - is there a "correct search engine"?
    – Kerrek SB
    Commented Jul 25, 2011 at 12:51

6 Answers 6

  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.


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.


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


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


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";

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.


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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