Click to See Complete Forum and Search --> : .htaccess RewriteRule issue


Girasquid
03-14-2007, 10:56 AM
Hello, all.

I am working on something that requires we create 'clean' URL's for users to view their profiles. We want to modify our .htaccess so that a user can type in website.com/profile/username instead of website.com/profile.cgi?username=username. This is what I have:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^profile/(.+)$ profile.cgi?username=$1

But for some reason, the value $1 is not being passed to profile.cgi(we are seeing the page that is displayed when no username is passed to it). Does anyone know what is going wrong?

Thanks,
Girasquid

jasonahoule
03-27-2007, 06:45 AM
Try showing the URL in the browser to see what value is being passed. The [R] will force another request for the new URL. You probably don't want to keep it there but it may help you debug.

RewriteRule ^profile/(.+)$ profile.cgi?username=$1 [R]

Girasquid
03-27-2007, 12:22 PM
As it turned out, the problem was actually due to a directive in the .htaccess for the directory above that one, which was conflicting with my RewriteRules.