Url with Page Number Parameter
6 posts
• Page 1 of 1
- [email protected]
-
- Posts: 6
- Joined: 29 Jan 2014, 00:50
Url with Page Number Parameter
Hi there,
I'm currently using these rewrites for my category pages with a URL like such: http://mysite.com/cbdmodules/categoryte ... egoryid=72
I'd like to use a very similar rule for when my url include a page number parameter.
http://mysite.com/testa/cbdmodules/cate ... tartpage=4
I'm not sure where to add the startpage parameter to these rules.
RewriteCond %{QUERY_STRING} ^categoryID=(\d+)$ [NC]
RewriteCond ${bf_categorymap:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^CBDModules/CategoryTemplates/DetailGrid/category\.aspx$ ${bf_categorymap:%1}? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${bf_revcategorymap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule (.+) CBDModules/CategoryTemplates/DetailGrid/category.aspx?categoryid=${bf_revcategorymap:$1} [NC,L]
Any help would be appreciated.
I'm currently using these rewrites for my category pages with a URL like such: http://mysite.com/cbdmodules/categoryte ... egoryid=72
I'd like to use a very similar rule for when my url include a page number parameter.
http://mysite.com/testa/cbdmodules/cate ... tartpage=4
I'm not sure where to add the startpage parameter to these rules.
RewriteCond %{QUERY_STRING} ^categoryID=(\d+)$ [NC]
RewriteCond ${bf_categorymap:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^CBDModules/CategoryTemplates/DetailGrid/category\.aspx$ ${bf_categorymap:%1}? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${bf_revcategorymap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule (.+) CBDModules/CategoryTemplates/DetailGrid/category.aspx?categoryid=${bf_revcategorymap:$1} [NC,L]
Any help would be appreciated.
- [email protected]
-
- Posts: 6
- Joined: 29 Jan 2014, 00:50
Re: Url with Page Number Parameter
A more general question to help resolve my issue. Is it possible to use mapping files with URLs that have multiple parameters? Only one of the parameters in the URL would be used with the map file.
Examples:
1) http://www.mysiste.com/category.aspx?categoryID=3 - This URL works fine with my rules in my post.
2) http://www.mysite.com/category.aspx?categoryID=3&page2 - This URL never gets rewritten with the rules I have in place. I'd like to have it rewritten exactly the same as the above URL.
Please help!
thanks
tina
Examples:
1) http://www.mysiste.com/category.aspx?categoryID=3 - This URL works fine with my rules in my post.
2) http://www.mysite.com/category.aspx?categoryID=3&page2 - This URL never gets rewritten with the rules I have in place. I'd like to have it rewritten exactly the same as the above URL.
Please help!
thanks
tina
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Url with Page Number Parameter
I'll answer the second one. All you need is to remove '^' and '$'. So if category parameter is present anywhere in the querystring, it gets rewritten:
However, as you can see, you completely loose other parameters in process. Is it okay?
- Code: Select all
RewriteCond %{QUERY_STRING} categoryID=(\d+) [NC]
RewriteCond ${bf_categorymap:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^CBDModules/CategoryTemplates/DetailGrid/category\.aspx$ ${bf_categorymap:%1}? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${bf_revcategorymap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule (.+) CBDModules/CategoryTemplates/DetailGrid/category.aspx?categoryid=${bf_revcategorymap:$1} [NC,L]
However, as you can see, you completely loose other parameters in process. Is it okay?
- [email protected]
-
- Posts: 6
- Joined: 29 Jan 2014, 00:50
Re: Url with Page Number Parameter
Thanks Andrew, those rules work as you stated.
Unfortunately the startpage parameter is needed to determine what products are to be displayed on the category page.
I'm not sure what my choices are with using rewrite rules. SEO team doesn't want to see startpage parameter on the URL but I need it to determine the group of products that belong on the page. Of course I can make a code change to approach it differently but I was hoping a rewrite rule would do the trick.
What are my options with ISAPI rewrites to accomplish what I need?
Thanks in advance.
tina
Unfortunately the startpage parameter is needed to determine what products are to be displayed on the category page.
I'm not sure what my choices are with using rewrite rules. SEO team doesn't want to see startpage parameter on the URL but I need it to determine the group of products that belong on the page. Of course I can make a code change to approach it differently but I was hoping a rewrite rule would do the trick.
What are my options with ISAPI rewrites to accomplish what I need?
Thanks in advance.
tina
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Url with Page Number Parameter
I'd say that you need an additional rule to one you already had. Something along the lines:
You see what i'm saying?
- Code: Select all
RewriteCond %{QUERY_STRING} categoryID=(\d+) [NC]
RewriteCond %{QUERY_STRING} startpage=(\d+) [NC]
RewriteCond ${bf_categorymap:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^CBDModules/CategoryTemplates/DetailGrid/category\.aspx$ /%2/${bf_categorymap:%1}? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${bf_revcategorymap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule (\d+)/(.+) CBDModules/CategoryTemplates/DetailGrid/category.aspx?categoryid=${bf_revcategorymap:$2}&startpage=$1 [NC,L]
You see what i'm saying?
- [email protected]
-
- Posts: 6
- Joined: 29 Jan 2014, 00:50
Re: Url with Page Number Parameter
Hi Andrew,
I see where your going with the rules but it's not quite there yet.
I've changed the rules based on your suggestion using the snippet below. The rule rewrites but no products appear so I'm guessing there is a disconnect between the categoryID parameter and the map file. Also note the startpage parameter is not required and there could be other parameters added to the URL.
The results I get are:
FROM:
http://mysite.com/cbdmodules/categoryte ... tartpage=2
Rewrites to this:
http://mysite.com/get-well-gifts
RewriteCond %{QUERY_STRING} categoryID=(\d+) [NC]
RewriteCond %{QUERY_STRING} startpage=(\d+) [NC]
RewriteCond ${bf_categorymap:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^CBDModules/CategoryTemplates/DetailGrid/category\.aspx$ ${bf_categorymap:%1}? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${bf_revcategorymap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule (\d+)/(.+) CBDModules/CategoryTemplates/DetailGrid/category.aspx?categoryid=${bf_revcategorymap:$2}&startpage=$1 [NC,L]
Thanks for your help!
tina
I see where your going with the rules but it's not quite there yet.
I've changed the rules based on your suggestion using the snippet below. The rule rewrites but no products appear so I'm guessing there is a disconnect between the categoryID parameter and the map file. Also note the startpage parameter is not required and there could be other parameters added to the URL.
The results I get are:
FROM:
http://mysite.com/cbdmodules/categoryte ... tartpage=2
Rewrites to this:
http://mysite.com/get-well-gifts
RewriteCond %{QUERY_STRING} categoryID=(\d+) [NC]
RewriteCond %{QUERY_STRING} startpage=(\d+) [NC]
RewriteCond ${bf_categorymap:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^CBDModules/CategoryTemplates/DetailGrid/category\.aspx$ ${bf_categorymap:%1}? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${bf_revcategorymap:$1|NOT_FOUND} !NOT_FOUND
RewriteRule (\d+)/(.+) CBDModules/CategoryTemplates/DetailGrid/category.aspx?categoryid=${bf_revcategorymap:$2}&startpage=$1 [NC,L]
Thanks for your help!
tina
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests