php - search engine friendly blog urls -
hey in process of making blog site, have decided make own rather use 3rd party, cannot figure out how make url's seo friendly atm /blogpost.php?id=15 want /the-title there way without htaccess? atm using make urls'
echo '<a href="blogpost.php?id='.$row['id'].'">';
then using _get id , information database, replace id name gives me /blogpost.php?title=the-title
thanks help.
in htaccess put (if using apache)
rewriteengine on #ignores real files rewritecond %{request_filename} !-f #ignores real directorys rewritecond %{request_filename} !-d #ignores symlinks rewritecond %{request_filename} !-l #forwards request onto index.php orignal querystring still intact rewriterule (.+) index.php?url=$1 [qsa]
then thing after / forwared $_get['url'] in index.php. in index.php can have bootstrap class explode
/. can load appropriate class based on first element in array.
for example if url /articles
it load articles controller based on /articles
or if url /articles/about-something
the articles controller load article fetching article database about-something slug.
Comments
Post a Comment