Reputation: 2209
I generate friendly urls containing seo friendly name and id. Which of those is better:
Or other combination?
Upvotes: 4
Views: 1404
Reputation: 4023
I'm not sure that one will perform better than the other SEO'wise, but I personally prefer your 3rd choice http://domain.com/1234/super-friendly-seo-title. The reason being the page name is very clean in this case. The ID of 1234 is not really a valuable part of the page name, it is purely your unique identifier for the page. I think it also makes rewrite rules and code easier to deal with. The ID is really the only important part of the URL for determining which page to serve. The SEO text is completely superfluous.
A few notes: Make sure the page rendered is based solely on the ID and not the SEO text. For example you want:
to respond with the same page content.
The main requirement for this is to make sure you create a canonical link element on your page which has the URL to your currently preferred page name. For example: if your current page name should be Some-Other-Text, then your canonical link element would look like:
<link rel="canonical" href="http://domain.com/1234/Some-Other-Text" />
for the page with ID 1234.
You could work a 301 redirect into your code if the requested page name does not match your currently preferred page name, but it is not required as the canonical link element will produce the same result.
This beauty of this technique is you never have to write another rewrite rule if you change the page name. Since the ID stays the same, you change your page name whenever you like, and the canonical link element will act as a redirect for the search engines.
I hope this makes sense. If something is not clear please let me know and I'll clarify as best I can.
Upvotes: 6