-2

I`ve learning development of websites recently and have appreciated quite some concepts in php and mySQL databases. Since I use GET and POST i sometimes end up with such urls: http://seta.com/news.php?articleid=231. how do i make my urls look like this instead: http://seta.com/news/today.

Maybe if one helps me on the subject so that i can search, I don`t even know what I am looking for.

3 Answers3

0

This is called SEO urls or pretty urls. You can use the .htaccess file and regular expressions to rewrite the http://seta.com/news/today url to http://seta.com/news.php?articleid=231 for your program so your program can function without any modifications.

If your program in dynamically creating these links, you will have to update those places so it's outputting the urls as the new pretty urls.

Another way is to direct all urls to news.php and use $_SERVER['REQUEST_URI'] to extract the information from the url. This requires modifications to your code and it will stop working for the ?articleid=123 urls which is useful during development.

Chris Gunawardena
  • 5,338
  • 1
  • 21
  • 40
0

By using the GET method to submit data , a question mark followed by the submitted data will be shown like the article id for example : http://seta.com/news.php?articleid=231

<?php $article_id=$_GET['articleid']; ?>

By using the POST method , the url is not going to change :http://seta.com/news

<?php $article_id=$_POST['articleid']; ?>

i hope this is what you looking for

xyzdev
  • 23
  • 6
-3

You need to learn some MVC php frameworks then.. CodeIgnitor is good for start url like http://seta.com/news/today has URI Segments where news is 1st segment and today is 2nd segment.

IN .htaccess using mode_rewrite you can remove .php from the link and create your links accordingly as you want.