Nick Nick - 4 months ago 39
PHP Question

htaccess rule for slash(/) in place of dash(-)

I have a htaccess rule as follows:

RewriteRule ^restaurant-([0-9_-]+)-([a-zA-Z0-9_-]+)-([a-zA-Z0-9_-]+)-menu$ rest_menu?&id=$1&area=$2&Name=$3

The url is as follows:

But I want the url to be

How do I change my htaccess rule so that it starts working.

Notice: the "- " before menu is replaced by "/".


Use this rule i am assuming rest_menu is a php file.

Options -Multiviews
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^restaurant-([\d]+)-([\w-]+)-([\w-]+)/menu$ rest_menu.php?&id=$1&area=$2&Name=$3 [QSA,L]