.htaccess - Friendly url using php and htaccess -


I have been able to change the URL according to the values ​​received from the database. In my URL, I have been able to give this article ID and paragraph title Must have to pass this way.

  $ articleId = 123; $ ArticleTitle = 'first article'; Echoes' & lt; A href = "'. $ ArticleId.' And 'str_replace (", "-", $ article title). '' & gt; Read more & lt; / A & gt; ';   

In my htaccess file

  option + follow link reverted to revoked code% {REQUEST_FILENAME}! -f rewrite code% {REQUEST_FILENAME}! -d Recruit Rule (. *) display.php? Id = $ 1 and $ 2   

Then on the Display.php I will find the Article ID to get the method. But my problem occurs when I see the URL which is showing it like this.

  http: // localhost / news / 123 and the first article   

but I need to display the url in this way.

  http: // localhost / news / first-article   

and display the details of the article on Display.php file. I hope I have explained the problem clearly. Please advise. Thanks in advance.

I would say that you have to change it:

  RewriteRule (. *) Display.php? Id = $ 1 & amp; $ 2   

on:

  RewriteRule ^ (. +) [& Amp;] (. +) $ Display.php? id = $ 1 / $ 2    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -