This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: How to show friendly url
Author
Message |
bmaxplus
Newbie


Joined: 13 February 2010
Location: United States
Posts: 28
Posted: 06 March 2012 at 9:13am

Hello,
Please help.
I have a url:
www.mydomain.net/team/teamHome.aspx?t=kazan_akbars
www.mydomain.net/team/teamSchedule.aspx?t=kazan_akbars

I'd like to show something like this:

www.mydomain.net/team/kazan_akbars
www.mydomain.net/team/kazan_akbars/schedule

Back to Top
 
HeliconA
Admin Group


Joined: 02 March 2012
Posts: 4142
Posted: 07 March 2012 at 6:26am

Hello,

Try using the following:

Code:
RewriteEngine on
RewriteBase /

RewriteCond %{QUERY_STRING} ^t=([^&]+)$ [NC]
RewriteRule ^team/teamHome\.aspx$ /%1? [NC,R=301,L]
RewriteCond %{QUERY_STRING} ^t=([^&]+)$ [NC]
RewriteRule ^team/teamSchedule\.aspx$ /%1/schedule? [NC,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ /team/teamHome.aspx?t=$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/schedule$ /team/teamSchedule.aspx?t=$1 [NC,L]


Regards
Andrew

Back to Top
 
bmaxplus
Newbie


Joined: 13 February 2010
Location: United States
Posts: 28
Posted: 07 March 2012 at 12:18pm

Thanks for the reply.
I have it almoust working with rules like:

RewriteCond %{REQUEST_METHOD} !^POST$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^team/(.*)/schedule(/eurl.axd/.*)
TeamSchedule.aspx?l=$1 [NC,R=301,L]

but I when i enter:
http://mydomain/team/myteam/schedule

URL is changed to:

http://mydomain/TeamSchedule.aspx?l=myteam

Why it doesn't stay the way I entered it??

Thank You!
Back to Top
 
HeliconA
Admin Group


Joined: 02 March 2012
Posts: 4142
Posted: 12 March 2012 at 5:21am

Hello,

Why shouldn't it?

The pattern in the rule
Code:
RewriteRule ^team/(.*)/schedule(/eurl.axd/.*) TeamSchedule.aspx?l=$1 [NC,R=301,L]


IT matches the url /team/myteam/schedule --> /TeamSchedule.aspx?l=myteam

Regards
Andrew


Edited by HeliconA - 16 March 2012 at 4:32am
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version