Page 1 of 1

.htaccess help

Posted: Fri May 25, 2012 7:52 am
by Live24x7
Hello

I need to replace this exact url string :

/usr/userinfo.php?user=foo

by

/foo

I understand i need to do this with .htacess. But I have not been able to do that with google ssearches on the topic.

Any help would be greatly appreciated.

Thanks a lot

Re: .htaccess help

Posted: Fri May 25, 2012 5:36 pm
by pickle
You want to use mod_rewrite.

Just off the top of my head, it'll be something like this:

[syntax]RewriteEngine On
RewriteBase /
RewriteRule ^foo$ usr/userinfo.php?user=foo[/syntax]

Now that you know, you should be able to Google for the right stuff - you are far from the first person to have questions about mod_rewrite, so there is tons of info out there.

Re: .htaccess help

Posted: Fri May 25, 2012 9:42 pm
by Live24x7
thanks for answering.

There are plenty of answers available in google search. The issue is the term foo is to be replaced by a regex and none of the regex stuff seems to be working on my localhost

thanks anyways

Re: .htaccess help

Posted: Mon May 28, 2012 9:44 am
by pickle
Check that you actually have mod_rewrite installed.

Re: .htaccess help

Posted: Mon May 28, 2012 1:41 pm
by Live24x7
thanks i guess that was the problem :) it works now