1

I am creating job portal website. In that, for displaying job I use job.php?id='ID' i.e http://localhost/job.php?id=1 in URL.
I want to display it by using job title and location not id.

For example:

Job Title is : "PHP developer" and the Location is: "London"
So I want to display URL like

http://localhost/PHP-developer-jobs-in-London/

How to display this in PHP?

2 Answers2

0

You'll need to use your HTTP server to rewrite the URL to a PHP-script. Useful answers here on Stack Owerflow:

If you are on Apache server: Reference: mod_rewrite, URL rewriting and "pretty links" explained

If you are on nginx: How to write a url rewrite in nginx?

Community
  • 1
  • 1
Brodie Garnet
  • 432
  • 2
  • 8
0

try .htaccess url rewrite method

sample .htaccess file:

RewriteEngine On
RewriteRule ^jobs/([^/]*)$ job.php?job_title=$1 [L]

Refer this link: https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Edwin Thomas
  • 1,186
  • 2
  • 18
  • 31