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: Rewrite URL for Pagination
Author
Message |
patriotec
Newbie


Joined: 26 November 2010
Posts: 4
Posted: 05 September 2011 at 2:43pm

Profiles are such
www.domain.com/username which is a translation from www.domain.com/profile.asp?member=username

There is pagination for some of the profiles. I want
www.domain.com/username/pg2 instead of www.domain.com/profile.asp?member=username&pg=2

I already have:

RewriteBase /
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
RewriteCond %{URL} ^/[A-Za-z0-9_\,\s]+$
RewriteCond %{REQUEST_URI} ^(?!/ddtv.*) [NC]
RewriteRule ^[A-Za-z0-9_\,\s]+$ profile.asp\?member=$0 [NC,L]

Thanks in advance
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 06 September 2011 at 2:02am

Please try to have the following:

RewriteBase /
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

RewriteCond %{REQUEST_URI} !^/ddtv.* [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^./]+)(?:/pg(\d+))?$ profile.asp\?member=$1(?2&pg=$2) [NC,L]

__________________
Regards,
Anton
Back to Top
 
patriotec
Newbie


Joined: 26 November 2010
Posts: 4
Posted: 06 September 2011 at 2:16am

Thank, Tried that. Didn't work.

I switched to another format. Only problem is, I have to write 'http;//' in front of any link on that page or I'll end up with page not found

I switched to this:

RewriteBase /
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
RewriteCond %{URL} ^/[A-Za-z0-9_\,\s]+$
RewriteCond %{REQUEST_URI} ^(?!/ddtv.*) [NC]
RewriteRule ^[A-Za-z0-9_\,\s]+$ profile.asp\?member=$0 [NC,L]
RewriteRule ^(.*)/(.*)/$ profile.asp\?member=$1&pg=$2 [NC,L]

I know this can be done in a way that i dont have to put 'http;//' on links to the site itself for that page

TIA
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 06 September 2011 at 3:28am

You may have root-relative, not absolute, links on pages as well.

__________________
Regards,
Anton
Back to Top
 

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

Printable version Printable version