Redirecting via .htaccess to .php with arguments in current folder.

Posted by Jengerer on Stack Overflow See other posts from Stack Overflow or by Jengerer
Published on 2010-11-15T05:05:11Z Indexed on 2010/12/26 6:54 UTC
Read the original article Hit count: 252

Hey,

I'm trying to redirect something like foo/bar to ?foo=bar, so I can do www.mydomain.com/hey/foo/bar to www.mydomain.com/hey/?foo=bar, but I can't seem to get the syntax right. I tried the following:

RewriteEngine on
RewriteRule ^foo/(.*)$ ?foo=bar [NC]

But this doesn't work. How would I accomplish this? I tried adding a forward slash behind the question mark, but that makes it link to the root directory.

Thanks, Jengerer

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about redirect