matching request url with querystring in map file
2 posts
• Page 1 of 1
matching request url with querystring in map file
I have a map file which contains entries like
I want that I should be able to match the url with with or without querystring in map file.
my rules look like
- Code: Select all
details-125.htm?detail=true&id=310 product-delux.html
I want that I should be able to match the url with with or without querystring in map file.
my rules look like
- Code: Select all
RewriteCond %{HTTP:Host} ^(?:www\.)?example.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (?!admin)
RewriteCond ${map:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*?\.(?:html|htm)) ${map:${lower:$1}} [NC,L,NS,QSA,R=301]
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: matching request url with querystring in map file
Hello,
You'll have to use 2 different rules. But you can still use the same mapfile. Look:
Also, I'd think that REQUEST_FILENAME check can be omitted, since you do the mapfile check anyway.
Regards
You'll have to use 2 different rules. But you can still use the same mapfile. Look:
- Code: Select all
RewriteCond %{HTTP:Host} ^(?:www\.)?example.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (?!admin)
RewriteCond ${map:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*?\.(?:html|htm)) ${map:${lower:$1}} [NC,L,NS,QSA,R=301]
RewriteCond %{HTTP:Host} ^(?:www\.)?example.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} (?!admin)
RewriteCond %{QUERY_STRING} (.*)
RewriteCond ${map:$1\?%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^(.*?\.(?:html|htm)) ${map:${lower:$1\?%1}} [NC,L,NS,QSA,R=301]
Also, I'd think that REQUEST_FILENAME check can be omitted, since you do the mapfile check anyway.
Regards
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests