Escaping + character in .htaccess

Discussion in 'Site & Server Administration' started by freshdevelopment, Sep 24, 2010.

  1. #1
    I have a line in my htaccess like this:

    RewriteRule ^recommends/([A-Za-z0-9-+]+)/?$ linkfowarder.php?linkname=$1 [L]
    Code (markup):
    Essentially I want it to map anything with letters, numbers, hyphens and the plus sign as folllows:

    www.site.com/recommends/example-link/
    www.site.com/recommends/Example123/
    www.site.com/recommends/example+123/

    It fails because of the + after the hyphen, inside the square brackets. But only on some setups!

    Does anyone know a way around this, or how I can escape it? I have tried a few things including \+

    Thanks :cool:
     
    freshdevelopment, Sep 24, 2010 IP