querystring with multiple parameters
3 posts
• Page 1 of 1
querystring with multiple parameters
Hi, I have these two rules working but can't figure out how to have the category rule accept category names with a dash "-" in it.
The second rule works.
This do work (first rule): www.mydomain.com/en/cats
and this also works: www.mydomain.com/en/cats-1/ <-- but I do not want the slash at the end here!
but not: www.mydomain.com/en/cats-1
The second rule
This works: www.mydomain.com/en/cats/my-holy-birma
and also this: www.mydomain.com/en/cats-1/my-holy-birma
The rules are:
RewriteEngine on
RewriteBase /
How can I correct the rules to make the category names work with a dash in the category name?
Kind Regards
/ Anejo
The second rule works.
This do work (first rule): www.mydomain.com/en/cats
and this also works: www.mydomain.com/en/cats-1/ <-- but I do not want the slash at the end here!
but not: www.mydomain.com/en/cats-1
The second rule
This works: www.mydomain.com/en/cats/my-holy-birma
and also this: www.mydomain.com/en/cats-1/my-holy-birma
The rules are:
RewriteEngine on
RewriteBase /
- Code: Select all
# LANGUAGE + CATEGORY
# EX: pages.asp?lng=en&category-name=cats
RewriteCond %{QUERY_STRING} lng=([^&]+)&category-name=([^&]+) [NC]
RewriteRule ^pages\.asp$ /%1/%2? [NC,R=301,L]
RewriteRule ^([^-]+)/([^-]+)$ /pages.asp?lng=$1&category-name=$2 [NC,L]
# LANGUAGE + CATEGORY + PAGE
# EX: pages.asp?lng=en&category-name=cats&pet-name=birma
RewriteCond %{QUERY_STRING} lng=([^&]+)&category-name=([^&]+)&pet-name=([^&]+) [NC]
RewriteRule ^pages\.asp$ /%1/%2/%3? [NC,R=301,L]
RewriteRule ^([^-]+)/([^/]+)/(.*)$ /pages.asp?lng=$1&category-name=$2&pet-name=$3 [NC,L]
How can I correct the rules to make the category names work with a dash in the category name?
Kind Regards
/ Anejo
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: querystring with multiple parameters
Hello,
I'm not sure why you use "([^-]+)/", try to replace all of them with "([^/]+)/"
Regards
Andrew
I'm not sure why you use "([^-]+)/", try to replace all of them with "([^/]+)/"
Regards
Andrew
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests