I'm looking to make some cleaner urls so that it basically, the web address looks nicer.
currently my url looks like this ..
...co.uk/article.php?sport=football&id=23
.. & title for the post could be.. erm .."this is the title"
i have been looking around the web and all over youtube trying to find a video to help as i hardly take any info in when i read stuff, so videos seems more productive for me. What i would like is my url to read something like...
...co.uk/sport/football/this-is-the-title
.. and if it was another topic something like...
...co.uk/sport/tennis/this-is-another-title
...something nice and clean and tells people exactly what they're looking at. Also, i would like to have it so when its on pages, them pages dont have to have there extension added on so you dont have to put .php
or .html
on the end of the address as well...
You must keep id also in the pretty URL like the URL structure of Stackoverflow here. So instead of:
/sport/football/this-is-the-title
have it like:Once that is settled let's now look into establishing mod_rewrite code to achieve it.
Enable mod_rewrite and .htaccess through
httpd.conf
and then put this code in your.htaccess
underDOCUMENT_ROOT
directory: