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

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -