php - htaccess mod_rewrite -


I'm trying to do something with it, whenever I go to a page:

http://www.example.com/character.php?id=3

I want to overwrite it:

  http://www.example.com/character/Jim_Carrey  

Which is the line of the curriculum, id character .. .

For such an example ... I have tried to work with it, but I could not get much of the HTACK production Yes, because I .htaccess is the truth.

This is actually another way:

  1. On the website, you write to all your links the way you want to see it. For example http://www.site.com/character/Jim_Carrey

  2. In your database, you add fields, usually "slug" Or "post_slog" which indicates "part of UML" Gimarera. This is a primary element, which will be very much in the way of the primary key. So make sure that you have a function that takes care of creating a slug based on a given string string (for example the title of the post) and make sure there is no duplicate.

  3. Then you do something like this in your .htaccess (on the root folder)

      Reviving On Rewriteable ^ Characters / ([a-z0 - 9 _ \ -] +) / $ character.php? Slug = $ 1 [L, NC]  
  4. In the end, in your character.php script, you do not encrypt the database against the id but the post_slug field against.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -