# What is the best file extension for an SEO friendly URL?

I'm working for a website to convert the website URL to an SEO friendly URL. I plan to use this:

example.com/category-name/pageid-123-page-name

I looked at some similarly categorized, highly ranked websites. They have the same structure, except for one thing. In one case, the URL format was

example.com/category-name/pageid-123-page-name.html

Another was

example.com/category-name/pageid-123-page-name.php

Now I know the text in URLs help with SEO. Is it more helpful to have a file extension? If yes, which one is better?

Or if my current plan is okay, will it be better with a / at the end?

• Why should Google rank a .php page higher than .html? Or URLs with slashes higher than URLs without? If it doesn't make a difference to your users, then it won't make a difference to search engines. If Google ranked pages using arbitrary metrics like those, then their search results would be useless. Putting .html pages before .php pages doesn't do web users any bit of good. – Lèse majesté Nov 30 '10 at 7:03
• URIs shall be short, so it's best to leave out the extension altogether. – DanMan Feb 23 '13 at 19:33

Including or not the extension is not the most important point for SEO. Content, clean and semantic markup, meta description, title.... these things weight more.

However, if you are intending to optimize your URLs (what isn't a bad thing at all), think on users first (as for everything).

mysite.com/category-name/pageid-123-page-name


I suggest something even more friendly, like:

mysite.com/category-name/page-name


Unless you are using a industry made solution, coding a routine in php to handle those request should not be a huge challenge.

Ah, and don't get worried about every single minor difference between you and other sites. If you think the way you do is better for your users, go ahead in your own way. You probably is making better and getting ahead of them.

• This. If you need to add a page ID, do it at the end of the url. The more important the keywords to you are, the earlier in the URI they should be. – Stephan Muller Nov 30 '10 at 18:16
• will there be any difference in urls like (1) mysite.com/category-name/title-name/ and (2) mysite.com/title/title-name? in the first the category-name is dynamic where as in the second the word title is static ... while generating sitemap with category name it will he hierarchy were as if it is just title keyword it will not be hierarchy... which one is good for seo and for users it will be if there is the dynamic category name... suggestions please... – Jayapal Chandran Dec 17 '12 at 13:43
• if using the second way then it is better to remove the keyword title which can remove a url segment.. isn't it? – Jayapal Chandran Dec 17 '12 at 13:49

URL, they matter a lot less in comparison to what the content it contains.

No matter how much detailed you make your URL, if the content you put inside like <title>, <h1>, <h2>, etc. is meaning less, your page will not rank higher.

• Well, I know that. URl and h1 title is going to be same, But here I have 3 choice. High ranked websites uses extension. Now my question is which one will be better choice? – Aajahid Nov 30 '10 at 8:34
• @Shakti, I did answer your question in the first sentence URL, they matter a lot less, you can go with any choice – Starx Nov 30 '10 at 8:42
• Technically, the URL matters. It's just that pointless "optimizations" like the ones in question don't matter. It matters if you have a clean and descriptive URL. It doesn't matter whether or not you put an extension at the end of a URL. It'd be stupid if that made any sort of a difference. And it's a waste of time searching for these micro-optimizations that add no value for users. Why not focus on the optimizations that actually improve your site and are good for both users and search engines? – Lèse majesté Nov 30 '10 at 9:29

The difference in ranking caused by file extensions and slashes in URL's is minimal. Choose whatever is easiest for you to work with (for example if you have to wrestle with a CMS)

The reasons the competition ranks higher than you do will be content and the number/quality of links pointing to those sites.

## protected by dan♦Jan 16 '15 at 7:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).