Mod Rewrite Help

Discussion in 'Apache' started by netaddict, May 24, 2005.

  1. #1
    Current Dynamic URL:
    h**p://www.whatever.com/some-category/display.htm?name=this%20is%20string

    New Static URL:
    h**p://www.whatever.com/some-category/this-is-string.htm

    Any solutions?
     
    netaddict, May 24, 2005 IP
  2. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #2
    just-4-teens, May 24, 2005 IP
  3. netaddict

    netaddict Peon

    Messages:
    640
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ya nice tool.... I am experimenting with that tool.

    Can somebody tell how to replace all the spaces in my URL with (-) without the parenthesis?

    Thanks :)
     
    netaddict, May 24, 2005 IP
  4. netaddict

    netaddict Peon

    Messages:
    640
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Any way of removing spaces in my URL with dashes...... using mod rewrite ?
    Is it possible?
     
    netaddict, May 25, 2005 IP
  5. Obelia

    Obelia Notable Member

    Messages:
    2,083
    Likes Received:
    171
    Best Answers:
    0
    Trophy Points:
    210
    #5
    I can't think of any way of doing it that would be elegant and not convoluted, through .htaccess. Basically you want a function similar to php's ereg_replace(), but through a mod-rewrite regular expression.

    But spaces aren't supposed to be part of urls anyway. Look into changing the urls themselves, using something like ereg-replace() if you use php. Add dashes to make the urls, and remove them when you want to use the variables as page titles and so on. Basically you would have a few lines of code that will allow you to swap between the variables:

    $dash_variable = ereg_replace(" ","-",$somevariable);

    It's probably better to use an underscore rather than a dash, however. You're more likely to want to use a dash within a title phrase, such as when it's part of someone's name.
     
    Obelia, Jun 10, 2007 IP