.htaccess (mod_rewrite) + PHP/MySQL

Currently reading:
.htaccess (mod_rewrite) + PHP/MySQL

Joined
Apr 30, 2006
Messages
2,884
Points
698
Location
Middle o' no where
So im making a website in PHP With a MySQL Database for the Services & news Sections. Im going to use a mod_rewrite code to rewrite the id urls to seo friendly urls.

Now issue one is, how do i get the urls to pick the data from the title of the article in the database? so instead of being /news.php?id=1 it is /news/articlestitle

Also...

Now when i use the database it is going to create urls like news.php?id=1 and so on. When i set it to create a menu structure from the categories it is going to use the above style url for the urls. How do i get it to rewrite them to similar to above when it takes the data from the database? or does mod_rewrite do this for you?

Hmm im not very good at explaining this am i....

any help appreciated

J
 
Last edited:
One from my bookmarks: http://corz.org/serv/tricks/htaccess2.php

The trick is although the users browser sees the friendly url the php script is actually seeing the original - so it can get the variables out the url just as before.

I've done it on my website to go from
http://www.free-mobile.net/gallery_browse.php?cat=cartoons&size=240
to http://www.free-mobile.net/cartoons/240x320

the php didn't need changing, just added the rewrite to the htaccess file
Thanks alot, ill have to just make the site and go from therei suppose. YOu wil be getting more messages from me :p


Your msn is borked :)

I asked you where are you going to get the seo friendly titles from? Will they be automatically created from the page title, or will you want to set your own names up?

Yep it is, damned pc kept crashing....

I was going to get page titles from the title of the article as in the database id have id, title, subtitle, content1 and so on.....
 
Back
Top