0

My php project which is supported with javascript works in one index.php page. In this page, I get the id with url parameters such as index.php?id=3627. Every id represents different sources, and everyone has specific tittle and embed code. In this case, I want to change the url structure with .htaccess and get the id in the same time. For example, index.php/i-need-to-put-title.html should give me the id number for $_GET['id'] request. My brain is frozen and I drunk lot of coffee. How can I do that, I need suggestions and help.

NOTE: My question is not related with possible dublicate header. I don't need to write /id/3627, I have to convert it to /title-is-here.html which is not related with id. It more than how to use question. Thank you.

EddyTheDove
  • 12,979
  • 2
  • 37
  • 45
  • 1
    Possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – Croises Mar 04 '17 at 15:19
  • @Croises I know how to use the .htaccess just I have to create a true mod_rewrite structure. I can write it like example.com/id/3627. However, I need to write examle.com/title-is-here.html and I need suggestion –  Mar 04 '17 at 15:32
  • 1
    This is not automatically possible. There is no one rule to achieve this. You need some mapping from slug to id to make this happen, see e.g. [`RewriteMap`](https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritemap) or do the mapping in `index.php` – Olaf Dietsche Mar 04 '17 at 16:20
  • 1
    @Croises This is a bad duplicate to say the least, quoting [Joel](https://stackoverflow.blog/2011/01/05/the-wikipedia-of-long-tail-programming-questions/): "That’s the moral equivalent of saying RTFM.” – Olaf Dietsche Mar 04 '17 at 16:22
  • @OlafDietsche On the contrary, everything is explained in the indicated page – Croises Mar 04 '17 at 17:39

0 Answers0