0

Having an issue with re-writing a URL from - dashes to + signs I have searched through the forums and found how to get the first dash... but cant figure out how to break all of my words apart. any help would be appreciated.

URL: http://sub.domain.com/foo/bar/_/could-be-any-topic/eventual-search-term-here-r1646

so far i have:

RewriteCond %{HTTP_HOST} ^sub\.domain\.com$
RewriteRule foo\/bar\/_\/(.+)\/([^-]*)-+(.*)\-r(.+) http://sub.domain.com/$2+$3

which would output: http://sub.domain.com/eventual+search-term-here

The search term could have endless amount of words in it so wondering how i go about that.

Thanks

/Steve

Citti
  • 423
  • 1
  • 6
  • 23

1 Answers1

0

Try using something like(if it's ISAPI_Rewrite3):

RewriteEngine on
RewriteRule ^foo/bar/_/[^/]+/([^-]*)-(.*) /$1+$2 [NC,LP,R=301]
Andrew
  • 511
  • 3
  • 7
  • yea still doesn't work :( Is there a way to break apart x amount of strings... I mean i would essentially need to break apart anything with an "-" before it and then rebuild every separate string with a "+" If i am explaining that correctly. – Citti Jul 09 '14 at 17:29
  • There's no need for that. LP-flag is a loop flag. Should work. It could be as simple as adding one more directive: "RewriteBase /" in front of the actual rule. I'd also suggest contacting helicontech and providing them with the logs. They'll help. – Andrew Jul 10 '14 at 01:28