What's wrong with this regular expression
4 posts
• Page 1 of 1
What's wrong with this regular expression
Hi ALL,
I don't understand that why my following regular expression can't work on RegExp Test. Can someone help me find the problem? Thanks a lot!
^subcategory\.aspx\?CatgId\=1\&subCatgId\=([0-9]+)
teststring: subcategory.aspx?CatgId=1&subCatgId=50011995
Thank you very much
I don't understand that why my following regular expression can't work on RegExp Test. Can someone help me find the problem? Thanks a lot!
^subcategory\.aspx\?CatgId\=1\&subCatgId\=([0-9]+)
teststring: subcategory.aspx?CatgId=1&subCatgId=50011995
Thank you very much
Re: What's wrong with this regular expression
The thing is that in ISAPI_Rewrite 3 the query string is matched separately:
RewriteCond &{QUERY_STRING} ^CatgId=1&subCatgId=(\d+)$ [NC]
RewriteRule ^subcategory\.aspx$ ...
RewriteCond &{QUERY_STRING} ^CatgId=1&subCatgId=(\d+)$ [NC]
RewriteRule ^subcategory\.aspx$ ...
Re: What's wrong with this regular expression
Thanks for your reply, Anton.
I have try this
RewriteCond %{QUERY_STRING} ^CatgId=1&subCatgId=(\d+)$ [NC]
RewriteRule ^subcategory\.aspx$ /skincare/%1 [NC,L,R=301]
but it doesn't work. %1 cannot bring value to /skincare/%1
like this
subcategory.aspx?CatgId=1&subCatgId=123
=>
/skincare/ <= no value after skincare
thanks
I have try this
RewriteCond %{QUERY_STRING} ^CatgId=1&subCatgId=(\d+)$ [NC]
RewriteRule ^subcategory\.aspx$ /skincare/%1 [NC,L,R=301]
but it doesn't work. %1 cannot bring value to /skincare/%1
like this
subcategory.aspx?CatgId=1&subCatgId=123
=>
/skincare/ <= no value after skincare
thanks
Re: What's wrong with this regular expression
"but it doesn't work. %1 cannot bring value to /skincare/%1"
- this is strange as the rule looks fine.
Please confirm you are using ISAPI_Rewrite v3.
Enable logging by putting the following in httpd.conf:
RewriteLogLevel 9
and provide rewrite.log records for the test request subcategory.aspx?CatgId=1&subCatgId=123
- this is strange as the rule looks fine.
Please confirm you are using ISAPI_Rewrite v3.
Enable logging by putting the following in httpd.conf:
RewriteLogLevel 9
and provide rewrite.log records for the test request subcategory.aspx?CatgId=1&subCatgId=123
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests