Jump to content

mod_rewrite with mysql


RAD!S

Recommended Posts

Hello everyone! I'm new here and I hope you'll help me find a solution to my problem!

 

I have written a blog in php, and all my articles are identified with their id number.

So if anyone wants to see a particular article, he clicks on a link that opens

mysite.fr/view.php?nArticle=9 for example.

I'd like to rewrite it so that it is prettier, but i don't want to have mysite.fr/view/9 because I don't want the user to see the number at all.

 

I have seen that wordpress blogs write in their url the title of each article.

 

So that's my question : can I make a request to my database, get the article title, and rewrite the url so that it is mysite.fr/name_of_the_article ?

 

I have searched the web and this forum but haven't found... Everyone talks about .htaccess files but I thinks that in order to question my DB I have to write it in the view.php file...

 

Thanks in advance !

Link to comment
Share on other sites

I have found a solution!

I have added a field in my database "urlname", and every article has its unique url name

The links now refer to view.php?name=blabla

And I just have to rewrite it !

 

Thanks anyway

Link to comment
Share on other sites

  • 4 months later...

i would still like to see:

mysite.fr/articles/name_of_the_article

instead of:

mysite.fr/articles.php?name=name_of_the_article

or

mysite.fr/articles.php?num=9

or

view.php?name=blabla

(from db point of view basically article id number will have an article title linked to it in the same row...)

can anyone help?

RAD!S solution "works", but not what am looking for!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.