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: Combine hide extensions and seo friendly
Author
Message |
jovana
Newbie


Joined: 27 November 2011
Posts: 3
Posted: 27 November 2011 at 12:59pm

I'am struglle on combining two methode's.

Hide extensions works fine:
Code:
RewriteEngine on
RewriteRule ^([^?]+)\.asp$ $1 [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME}.asp -f
RewriteRule (.*) $1.asp [QSA]


search engine friendly URLs works fine:
Code:
RewriteEngine on
RewriteRule ^(.*?\.asp)/([^/]*)/([^/]*)(/.+)? $1$4?$2=$3 [NC,LP,QSA]


How can I combine these two?

e.g
I have: www.mysite.com/about.asp?item1=a1&item2=a2&item3=a3
using like this: www.mysite.com/about/item1/a1/item2/a2/item3/a3

I hope something like this is possible.

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 29 November 2011 at 5:11am

Well,

The second one is way different from the one you need, in case you
want to deal with www.mysite.com/about.asp?item1=a1&item2=a2&item3=a3

Try using the following instead:
Code:
RewriteCond ^([^=]+)=([^&]+)&([^=]+)=([^&]+)&([^=]+)=([^&]+)$ [NC]
RewriteRule ^(.*)\.asp$ $1/%1/%2/%3/%4/%5/%6? [NC,R=301,L]


This must do the redirect from /about.asp?item1=a1&item2=a2&item3=a3 to /about/item1/a1/item2/a2/item3/a3


Regards
Andrew
Back to Top
 
jovana
Newbie


Joined: 27 November 2011
Posts: 3
Posted: 29 November 2011 at 6:53am

@Andrew many thx for your reply.

It's not working jet. I think I have not explained clearly:

I need this url /about/item1/a1/item2/a2/item3/a3 rewrite to /about.asp?
item1=a1&item2=a2&item3=a3.

Now it's rewriting the other way around :-)
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 30 November 2011 at 3:39am

oh, okay.

Try this one:

Code:
RewriteCond %{REQUEST_FILENAME}.asp -f
RewriteRule ([^/])/([^/])/([^/])/([^/])/([^/])([^/])([^/]) /$1.asp?$2=$3&$4=$5&$6=$7? [NC,L]


Regards
Andrew



Back to Top
 
jovana
Newbie


Joined: 27 November 2011
Posts: 3
Posted: 30 November 2011 at 5:00am

Thanks for the help. unfortunately it is not the disired results.
Please view a piece of the rewrite log

Code:
[rid#13442192/initial] (2) init rewrite engine with requested uri
/about/id/5
[rid#13442192/initial] (1) Htaccess process request C:\Program
Files\Helicon\ISAPI_Rewrite3\httpd.conf
[rid#13442192/initial] (3) applying pattern '([^/])/([^/])/([^/])/([^/])/([^/])
([^/])([^/])' to uri '/about/id/5'
[rid#13442192/initial] (2) init rewrite engine with requested uri
/favicon.ico
[rid#13442192/initial] (1) Htaccess process request C:\Program
Files\Helicon\ISAPI_Rewrite3\httpd.conf


Edited by jovana - 30 November 2011 at 5:01am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 30 November 2011 at 5:18am

I did it only for:

/about/item1/a1/item2/a2/item3/a3

For 1 param section, you can create your own rule. Does it work for 3 params?
Back to Top
 

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

Printable version Printable version