redirect help... Ending Default.aspx
5 posts
• Page 1 of 1
- mdameron76
-
- Posts: 8
- Joined: 18 Dec 2012, 11:49
redirect help... Ending Default.aspx
Here is what i'm trying to do...
'I want to still be able to use real aspx pages at the root
http://www.sample.com/real.aspx
'Rewrite Category Pages
http://www.sample.com/example-category/default.aspx
http://www.sample.com/example-category/ -> redirect back to http://www.sample.com/example-category/default.aspx
http://www.sample.com/example-category -> redirect back to http://www.sample.com/example-category/default.aspx
'Rewrite Sub Categories
http://www.sample.com/example-category/example-sub-cat.aspx
http://www.sample.com/example-category/sub-cat-title-again.aspx
Can anybody help shine some light on this? I just keep getting failed attempts
'I want to still be able to use real aspx pages at the root
http://www.sample.com/real.aspx
'Rewrite Category Pages
http://www.sample.com/example-category/default.aspx
http://www.sample.com/example-category/ -> redirect back to http://www.sample.com/example-category/default.aspx
http://www.sample.com/example-category -> redirect back to http://www.sample.com/example-category/default.aspx
'Rewrite Sub Categories
http://www.sample.com/example-category/example-sub-cat.aspx
http://www.sample.com/example-category/sub-cat-title-again.aspx
Can anybody help shine some light on this? I just keep getting failed attempts
Re: redirect help... Ending Default.aspx
Hello,
Please try to use the following rules:
RewriteBase /
RewriteRule ^([^./]+)/?$ /$1/default.aspx [R=301,L]
and as for sub-categories, I didn't understand what to rewrite/redirect and where. Please clarify.
Please try to use the following rules:
RewriteBase /
RewriteRule ^([^./]+)/?$ /$1/default.aspx [R=301,L]
and as for sub-categories, I didn't understand what to rewrite/redirect and where. Please clarify.
- mdameron76
-
- Posts: 8
- Joined: 18 Dec 2012, 11:49
Re: redirect help... Ending Default.aspx
Thanks for the reply...
as for the sub-categories it will be as followed.
'Rewrite Sub Categories
http://www.sample.com/example-category/example-sub-cat.aspx -> subpage_lookup.aspx?title=?
http://www.sample.com/example-category/another-fake-directory/sub-cat-title-again.aspx -> subpage_lookup.aspx?title=?
but there can be unlimited sub directories so would I have to use more than one rule to handle each of the directories?
as for the sub-categories it will be as followed.
'Rewrite Sub Categories
http://www.sample.com/example-category/example-sub-cat.aspx -> subpage_lookup.aspx?title=?
http://www.sample.com/example-category/another-fake-directory/sub-cat-title-again.aspx -> subpage_lookup.aspx?title=?
but there can be unlimited sub directories so would I have to use more than one rule to handle each of the directories?
- mdameron76
-
- Posts: 8
- Joined: 18 Dec 2012, 11:49
Re: redirect help... Ending Default.aspx
Ok, so here is what I've came up with
RewriteBase /
RewriteRule ^([^./]+)/?$ /$1/default.aspx [R=301,L]
RewriteRule ^([^./]+)/([^./]+)/?$ /$1/default.aspx [R=301,L]
RewriteRule ^([^./]+)/default\.aspx$ /page.aspx?title=$1 [NC,L]
RewriteRule ^([^./]+)/([^./]+)/default\.aspx$ /page.aspx?title=$1 [NC,L]
RewriteRule ^([^./]+)/([^./]+)\.aspx$ /page.aspx?title=$1 [NC,L]
RewriteRule ^([^./]+)/([^./]+)/([^./]+)\.aspx$ /page.aspx?title=$1 [NC,L]
but it will only handle up to 2 sub-directories
basically I will be doing a lookup on the url to get the page content. and the urls will be based on the site hierarchy
is there a way to reduce this or make it better?
RewriteBase /
RewriteRule ^([^./]+)/?$ /$1/default.aspx [R=301,L]
RewriteRule ^([^./]+)/([^./]+)/?$ /$1/default.aspx [R=301,L]
RewriteRule ^([^./]+)/default\.aspx$ /page.aspx?title=$1 [NC,L]
RewriteRule ^([^./]+)/([^./]+)/default\.aspx$ /page.aspx?title=$1 [NC,L]
RewriteRule ^([^./]+)/([^./]+)\.aspx$ /page.aspx?title=$1 [NC,L]
RewriteRule ^([^./]+)/([^./]+)/([^./]+)\.aspx$ /page.aspx?title=$1 [NC,L]
but it will only handle up to 2 sub-directories
basically I will be doing a lookup on the url to get the page content. and the urls will be based on the site hierarchy
is there a way to reduce this or make it better?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: redirect help... Ending Default.aspx
Hello,
Our extensive experience tells that it's better to have a little more simple rules than one cumbersome rule. Reason for that is that a complicated big rule may sometimes fail to match the intended URL.
We strongly recommend creating a separate rule for a case, though we could have done it in less number of lines.
(having extra 20, 30, 50 lines or rules has never made any difference in terms of performance)
Regards
Andrew
Our extensive experience tells that it's better to have a little more simple rules than one cumbersome rule. Reason for that is that a complicated big rule may sometimes fail to match the intended URL.
We strongly recommend creating a separate rule for a case, though we could have done it in less number of lines.
(having extra 20, 30, 50 lines or rules has never made any difference in terms of performance)
Regards
Andrew
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 17 guests