i want that in my blogs that i develop in PHP, the URL should look something like http://mysite.com/jan2006/best-day-of-my-life
instead of something like this http://mysite.com/viewblog.php?id=25
where “best day of my life” is the title of my blog post
what tool do i use to do this automatically ?
and does this technique help search engine optimization ?
i want that in my blogs that i develop in PHP, the URL should
Share
You need to use .htaccess and Apache’s mod_rewrite. There is a mass of information out there on google & SO:
http://www.javascriptkit.com/howto/htaccess.shtml
http://www.besthostratings.com/articles/htaccess.html
http://www.bloghash.com/2006/11/beginners-guide-to-htaccess-file-with-examples/
One thing to note, however, is that given the example you state you will still need a unique identifier to your specific blog post in your URL (namely the ID), e.g:
It would actually need to be:
http://mysite.com/25/jan2006/best-day-of-my-lifeor
http://mysite.com/post/25/jan2006/best-day-of-my-lifeIf you have an Apache hosting setup, in your root you would need a file named ‘.htaccess’. Its contents would look like (for example):
As for
Yes, yes it does:
http://www.seocentro.com/articles/apache/mod_rewrite-seo-purposes.html
http://techie-buzz.com/how-to/create-seo-friendly-urls-using-mod-rewrite-and-php-part-1.html
http://www.seomoz.org/ugc/using-mod-rewrite-to-convert-dynamic-urls-to-seo-friendly-urls
http://webhostinggeeks.com/blog/2011/03/31/seo-friendly-links-with-mod_rewrite/