Reputation: 11
I am working with PHP and htacess for the first time. I am passing a variables in a query string to a URL and want this URL to look clean. Please help.
.htaccess file
RewriteEngine On
RewriteRule ^id-([0-9]+)/([0-9A-Za-z]+).html /detail.php?id=$1&display=$2
PHP code passing from one file to detail page URL is:
<a href='/detail.php?id={$info[id]}&display=$title1'>
Please help.
Upvotes: 1
Views: 851
Reputation: 655755
You need to print out the new URL in order to get it rewritten by mod_rewrite. Because mod_rewrite can only rewrite URLs that are requested. So try this:
<a href='/id-{$info[id]}-$title1.html'>
Upvotes: 2