views:

68

answers:

2

I just recently ported over my source code to Ubuntu Server from Windows and I've been having a few .htaccess mod_rewrite problems. I have mod_rewrite enabled for Apache. Here is my current .htaccess

RewriteEngine On

RewriteRule ^css/default/?$ css/default.css
RewriteRule ^user/?$ user.php
RewriteRule ^user/([A-Za-z0-9_]+)/?$ user.php?username=$1

Here are some examples of the problems that I'm having. For some reason, I can access

http://localhost/css/default

with no problem, but when I do

http://localhost/css/default/

it cannot find it. Also, accessing

http://localhost/user/hunter101/

doesn't seem to register hunter101 as a GET anymore... any suggestions? Thanks

A: 

Shouldn't you escape the forward slash?

RewriteRule ^user\/([A-Za-z0-9_]+)\/?$ user.php?username=$1

I could be wrong.

meder
I'm pretty sure mod_rewrite doesn't need forward slashes to be escaped.
David Zaslavsky
Furthermore for the sake of completeness: Shouldn’t the first slash not be escaped too?
Gumbo
+2  A: 

There might be some conflicts with MultiViews as your URL and files have a very similar name. Try to disable it:

Options -MultiViews
Gumbo
this fixed it, thanks!
Axsuul
interesting... nice inspecting Gumbo :)
meder