Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: TitleCase and hyphen Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hankman
Newbie
Newbie


Joined: 21 May 2007
Online Status: Offline
Posts: 6
Posted: 26 July 2010 at 1:52pm | IP Logged Quote hankman

Hi,

I can't seem to figure this out.  I would like to do the following redirect:

From:
http://www.example.com/profile/DrBobSmith-MD-NewYork-NY.html

To:
http://www.example.com/profile/Dr-Bob-Smith-MD-New-York-NY.html

Basically insert a hyphen before one or more instances of upper case [A-Z] followed by lower case [a-z], as long as the hyphen does not exist.

Another example:

From:
http://www.example.com/profile/JaneSmith-LosAngeles-CA.html

To:
http://www.example.com/profile/Jane-Smith-Los-Angeles-CA.html

Thanks for your help!

Back to Top View hankman's Profile Search for other posts by hankman
 
AndrushkaUS
Senior Member
Senior Member


Joined: 13 November 2009
Location: United States
Online Status: Offline
Posts: 1545
Posted: 27 July 2010 at 5:41am | IP Logged Quote AndrushkaUS

Hello,

It's a tricky task here. Please, try to use the following:

Code:
RewriteEngine on
RewriteBase /
RewriteRule ^(profile/[A-Z][a-z]+)([A-Z].*\.html)$ $1-$2 [NC,LP,R=301,L]


Regards
Andrew

__________________
The will to conquer is the first condition of VICTORY
Back to Top View AndrushkaUS's Profile Search for other posts by AndrushkaUS
 
hankman
Newbie
Newbie


Joined: 21 May 2007
Online Status: Offline
Posts: 6
Posted: 27 July 2010 at 9:32am | IP Logged Quote hankman

Hi Andrew,

Thanks for your reply.  I tried your solution and it does not seem to work.  When I apply the rule to:

http://www.example.com/profile/DrBobSmith-MD-NewYork-NY.html

I get http://www.example.com/profile/Dr-BobSmith-MD-NewYork-NY.html

Back to the drawing board.

 



Edited by hankman - 27 July 2010 at 9:35am
Back to Top View hankman's Profile Search for other posts by hankman
 
hankman
Newbie
Newbie


Joined: 21 May 2007
Online Status: Offline
Posts: 6
Posted: 27 July 2010 at 9:41am | IP Logged Quote hankman

Actually, I think I came up with a solution.  This seems to work for me:

Code:
^(profile/.*[a-z])([A-Z][a-z].*\.html) $1-$2 [LP]

With this code,

http://www.example.com/profile/DrBobSmith-MD-NewYork-NY.html 

it gives me

http://www.example.com/profile/Dr-Bob-Smith-MD-New-York-NY.html

I will test some more to see if this works for all cases.

Thanks.

 

Back to Top View hankman's Profile Search for other posts by hankman
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum