I want to rewrite
www.domain.com/xyzdetails.php?id=91741
to
www.domain.com/rakesh-gupta
rakesh-gupta
is saved as rakesh gupta
in the table as field title
for php id 91741
.
I tried method using below url, but didn't work out.
http://zenverse.net/seo-friendly-urls-with-htaccess/
Thanks
If you want to rewrite by any static string like rakesh-gupta/12345
then the rule can be
# www.domain.com/rakesh-gupta/12345
RewriteRule ^rakesh-gupta/(\d+)$
And if you think your rewrite URL will be dynamic instead then the regex can be written as ^(.*)/(\d+)$
. Here first group (.*)
is anything (title, name, business, .....) and second group \d+
is for id and the rule is
# www.domain.com/rakesh-gupta/12345
# www.domain.com/title/12345
# www.domain.com/...../12345
RewriteRule ^(.*)/(\d+)$ /xyzdetails.php?id=$2
Hope it will make you sense.