.htaccess rewrite rule with multiple variables

label Programming
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

Hi,

sorry i'm really bad skilled in .htaccess but i need to do this:

I need to have URL in this format:

http://www.domain.com/test/accomodation/search/?variable_2=aaa&variable_3=bbb

and the first variable is "accomodation" between slashes. I don't know how many variable i need after last slash, but as many as possible.

I tried something like this, but it doesn't work... Yes it work, but i can get any variable after last slah...

RewriteRule ^(accomodation)/search/(.*) accomodation.php?title_url=$1

Oct 19th, 2017
I see. So you are trying to change all ?= to "/"?
Before we do .htaccess, I need to know that are you using any PHP/Python framework?
Jun 12th, 2013

No i dont use any php framework

Jun 13th, 2013

Try out this:

<IfModulemod_rewrite.c>
RewriteEngine On
RewriteRule ^lookup/([a-z0-9\-]+)/item/?$ /lookup.php?id=$1
</IfModule>

This will match any alphanumeric (also will recognise dashes) string of any length as the 'id'. You can limit this to just numeric by changing the regex to ([0-9]+).

<IfModulemod_rewrite.c>
RewriteEngine On
RewriteRule ^lookup/([a-z0-9\-]+)/([a-z0-9\-]+)/?$ /lookup.php?id=$1&view=$2
</IfModule>

This one will match /lookup/123/some-text/ to /lookup.php?id=123&view=some-text


Jun 13th, 2013

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Oct 19th, 2017
...
Oct 19th, 2017
Oct 20th, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer