-3

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

2 Answers2

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
  • is it really possible to hide the id like this. – rahul Feb 04 '16 at 10:57
  • @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