0

I have a dynamic URL like http://example.comjobdetail.php?id=24 and I want to change this URL like http://example.comjobdetail/24 how can we do this ?

2 Answers2

0

If you are using Apache web server, you can use .htaccess file for this. Example:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^jobdetail\.php$ /jobdetail/%1? [L]

Also pls look to the related Question: .htaccess rewrite "/book.php?id=1234" to "/book/1234"

Sergei Shitikov
  • 287
  • 2
  • 12
0

Original URL:

http://www.example.com/jobdetail.php?id=24

Desired destination URL:

http://www.example.com/jobdetail/24/

.htaccess syntax:

RewriteEngine On
RewriteRule ^/?jobdetail/([^/d]+)/?$ jobdetail.php?id=$1 [L,QSA]

EDIT

If CSS/ JS don't load, add this line to your jobdetail.php header

<base href="http://example.com/">
Diogo Jesus
  • 318
  • 4
  • 19