Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

URL reWrite

Last post 08-17-2012, 4:01 AM by g1smd. 2 replies.
Sort Posts: Previous Next
  •  02-05-2011, 6:32 AM 77630

    URL reWrite

    Hi i am writing a script for a test server to prove concept.  I would like to have nice search engine friendly urls

     mysite.com/somethinggood.aspx (would break this down into one result (somethinggood)

    or

    mysite.com/somethinggood/moregoodstuff.aspx (would break this down into two results (somethinggood and moregoodstuff)

     

    then i could redirect the content appropriatly.

     

    I am pulling my hair out at the moment with getting a one solution fits all.  I can get one to work or the other but not both :( any help would be appreciated.

     thanks

    andrew

     

     

     

  •  02-05-2011, 11:47 AM 77653 in reply to 77630

    Re: URL reWrite

    Do you really need to use regex for this?

    You could just strip off everything before the first "/" and strip off the ".aspx" and then split on "/".

  •  08-17-2012, 4:01 AM 86188 in reply to 77653

    Re: URL reWrite

    ^(([^/]+/)*)([^/.]+)$  <-- extensionless URL

    ^(([^/]+/)*)([^/.]+)\.html$  <-- .html URL

     

    $1 contains path

    $3 contains filename

    Filed under:
View as RSS news feed in XML