Is there a way to make this URL:
http://readme.com/read?blog=10092
look like this:
http://readme.com/read/blog/10092
Using PHP?
Is there a way to make this URL:
http://readme.com/read?blog=10092
look like this:
http://readme.com/read/blog/10092
Using PHP?
It is not possible via PHP itself. Even the above example (read?blog) is not a php-only solution.
PHP is a parsed file. The webserver parses a .php script and displays it to the viewer. So you have to configure your server (Apach for example) to use the correct php file for the request. The most common solution is mod_rewrite (http://httpd.apache.org/docs/current/mod/mod_rewrite.html an lots of tutorials). You will have to edit yout .httaccess file and create configuration options.
One technique is by rewriting the url using .htaccess. Create a .htaccess (There's a dot in front of the file name!) file inside of your root folder and place the following code inside:
Options +FollowSymLinks
RewriteEngine on
RewriteRule /blog/(.*)/ read?blog=$1
Now you can go to the same page using the url :
http://readme.com/read/blog/10092
It looks like you need a PHP framework, like CakePHP or CodeIgniter. One of their main feature is the routine mechanism. However, you must first understand some Object-Oriented Programming in PHP.
Its more complicated with plain php, you have to use htaccess too. See this example:
RewriteEngine on
RewriteRule ^/read/blog/([0-9]+)$ /read?blog=$1
Url rewriting is powered by .htaccess and inside it, regular expressions. If you want to know more about regular expressions, see wikipedia: https://en.wikipedia.org/wiki/Regular_expression