user2610240
user2610240

Reputation: 33

URl rewrite automatically for anchor tag onclick

url redirect for my anchor tag or onclick url is

http://localhost/re/jobs/view_jobs.php?id=14

how could i write url rewrite for this

Upvotes: 0

Views: 360

Answers (1)

JohnnyFaldo
JohnnyFaldo

Reputation: 4161

if you want to use the id:

EDIT:
RewriteEngine on 
RewriteRule ^jobs/([0-9]+)?$ view_jobs.php?id=$1

This basically says ^(starts with)re/jobs/ then ([0-9]+) - any number

?$ - end of query

directs to view_jobs.php?id=$1 ($1 = first regex)

And the anchor tag would be

http://localhost/re/jobs/14

Or if you wanted to use the job title for SEO purposes

RewriteEngine on 
RewriteRule ^jobs/([a-zA-Z0-9]+)?$ view_jobs.php?name=$1

And the anchor tag would be

http://localhost/re/jobs/jobname

Upvotes: 1

Related Questions