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 to remove dashes
Author
Message |
mobo10
Newbie


Joined: 02 November 2011
Posts: 1
Posted: 02 November 2011 at 10:00am

Good morning,

I would like to rewrite all of the pages on my website using the following logic:

all rewritten URLs will look like this:
page-name  - which will map to: PageName.aspx
another example
about-us - which will map to: AboutUs.aspx

So what the rewrite needs to do is remove the - and append the .aspx

Is this possible, or do I need a special rule for each page I want to rewrite?

Thanks!

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 03 November 2011 at 6:36am

Hello,

You're able to do the generic rule.
Please, try using:

Code:
RewriteEngine on
Rewritebase /

#everything with '-' will be edited
RewriteRule ([^-]+)-(.*) $1$2 [NC,LP,R=301]
#everything that is not a real file or folder will be appended with .aspx
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^./]+)$ /$1.aspx [NC,L]


Regards
Andrew
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 03 November 2011 at 6:44am

Of course, another option is mapfile. Take a look at "Comprehensive mapfiles" FAQ
Back to Top
 

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

Printable version Printable version