Link to home
Start Free TrialLog in
Avatar of sbliss
sbliss

asked on

mod_rewrite - simple I'm sure...

I need to rewrite the URL: www.something.com/gilmanciocia/opportunity/johndoe

to: www.something.com/gilmanciocia/opportunity/index.php?name=johndoe

My latest attempt doesn't work but I've never done this before and I'm half guessing:

<IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^gilmanciocia/opportunity/([A-Za-z]+)$ gilmanciocia/opportunity/index.php?name=$1
</IfModule>


ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sbliss
sbliss

ASKER

I did indeed have to set AllowOverride FileInfo and changing the rule to:

RewriteRule ^/gilmanciocia/opportunity/([A-Za-z]+)$ /gilmanciocia/opportunity/index.php?name=$1 [L]

did the trick. What's the [L] and [R] for?

Thanks for your quick and accurate response.
L means last, rules below aren't checked anymore
R forces an external redirection with HTTP status code 302 (moves temp.), so the URl will change in the location bar

AllowOverride... so you're using it in a .htaccess file. Usually there is no leading slash in the pattern (left side) of the RewriteRule. hm...
Avatar of sbliss

ASKER

This is on my MacMini in my studio. I use it as a development server and I provide client access through a free IP service...if that somehow explains the leading slash.

The bottom line is it works... and thanks again.

Steve