i dont want to show id from url like :http://localhost/project_name/project_detail.php?id=190 i have to send only project name from url http://localhost/horisolto/project_detail.php_project_name on next page i am not using any framework like MVC how can i pass project name and behind hide project_id please help me...thanks in advance
Asked
Active
Viewed 334 times
-3
-
1Use post request instead of get if necessary. – Niklesh Raut Feb 04 '16 at 10:50
-
https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ – online Thomas Feb 04 '16 at 10:52
-
You are saying that every project name in your db is unique? – rahul Feb 04 '16 at 10:58
-
1Possible duplicate of [PHP - hide url (GET) parameters](http://stackoverflow.com/questions/24459984/php-hide-url-get-parameters) – Rahul Feb 04 '16 at 10:58
-
@plum project_name is not unique i have search project by their id but through the url i want to hide project id and only show project name. – Kuldeep Pawar Feb 04 '16 at 11:26
2 Answers
0
just update config of your web server For nginx use
rewrite ^/project_name/project_detail.php_([^/]+)/?$ project_name/project_detail.php?id=$1;
for apache:
RewriteEngine On
RewriteBase /
rewrite ^/project_name/project_detail.php_([^/]+)/?$ project_name/project_detail.php?id=$1;
Note: for apache you can use it in .htaccess file
after this you must find your project by "project name" instead of id

Aleksey Solomakha
- 113
- 1
- 1
- 9
-
-
@Aleksey but i want search project by their project_id it is possible to hide id from url.(project_id_is necessary – Kuldeep Pawar Feb 04 '16 at 11:28
-
You can encrypt the id, and the server to decrypt it, but it's stupid. Your server must understand that he look, and if you do not pass id him then he will have to look for another option – Aleksey Solomakha Feb 04 '16 at 11:37
0
create a .htaccess file in your root and add the following code:-
RewriteEngine On # Turn on the rewriting engine RewriteRule ^project/([A-Za-z0-9-]) project-details?pid=$1 [L,QSA,NC]
In the loop where the projects are listed, change their href's to project/project-name/3.

rahul
- 841
- 1
- 8
- 18