I am trying to find a way to make pages accessible by pure URL using the $_GET[''].
But instead of the following request URL :
http://mywebsite.com/product.php?=1
I want :
http://mywebsite.com/product/1
Thank you and have a nice day.
I am trying to find a way to make pages accessible by pure URL using the $_GET[''].
But instead of the following request URL :
http://mywebsite.com/product.php?=1
I want :
http://mywebsite.com/product/1
Thank you and have a nice day.
You will need an PHP - URL-Router and mod_rewrite enabled on your Webserver.
If you're not that experienced you can use a PHP Framework, many Frameworks do have a Good Routing integrated.
Have a Look at some example tutroium: http://blogs.shephertz.com/2014/05/21/how-to-implement-url-routing-in-php/
You Should using Friendly url in php for creating spec url
you can use this approach:
how-to-create-dynamic-friendly-urls-using-php
how-to-create-friendly-url-in-php
please search friendly url in php
This can be achieved via url rewriting. Sounds like you want to achieve something like what a lot of PHP frameworks do.
for example http://codeigniter.com/user_guide/general/urls.html
Create a htaccess
file at root and write this code in that
RewriteEngine On
RewriteRule ^/product.php?id=([0-9]+)$ /product/$1
For more detail read about htaccess
If you are checking it at localhost than make sure you have restart your server after writing this code
RewriteEngine On
RewriteRule ^([^/]+)/([^/]+)$ index.php?$1=$2
The more number of arguments you enter here that you can access through url