I have URL like this:
site.com/fol1/fol2/?per1=Audi&per2=A4&type=2&per3=2009
How can I replace per1, per2, per3 to underscores?
htaccess rewriterule
Moderator: General Moderators
- phazorRise
- Forum Contributor
- Posts: 134
- Joined: Mon Dec 27, 2010 7:58 am
Re: htaccess rewriterule
As per thread title, i consider you want to do it with htaccess. So here little example -
[text]RewriteRule ^_/([A-Za-z0-9-]+)/_/([A-Za-z0-9-]+)/?$ page.php?per1=$1&per2=$2[/text]
put this in htaccess file.
and write urls something like -
[text]<a href="_/software/_/hardware">Your_link</a>[/text]
and while retrieving use -
But though this does the job, why are using _ to be appeared in urls. Use something meaningful. Instead you should specify URL which user can easily understand.
Htaccess is meant to be used for writing human friendly urls.
[text]RewriteRule ^_/([A-Za-z0-9-]+)/_/([A-Za-z0-9-]+)/?$ page.php?per1=$1&per2=$2[/text]
put this in htaccess file.
and write urls something like -
[text]<a href="_/software/_/hardware">Your_link</a>[/text]
and while retrieving use -
Code: Select all
$per1=$_GET['per1'];
$per2=$_GET['per2'];
Htaccess is meant to be used for writing human friendly urls.