[Hampshire] mod_rewrite

Top Page

Reply to this message
Author: Brian Chivers
Date:  
To: Hampshire LUG Discussion List
Subject: [Hampshire] mod_rewrite
Does anyone have any experience of using mod_rewrite and regexp ?

It's just that I have a piece of software I use in college that uses
mod_rewrite and I'm having problem with users with a dot / period in
there usernames.

The line that is causing the problem is this one

RewriteRule ^([^/\.]+)?/?$ user.php?username=$1 [L,QSA]

So from what I can understand if you call www.brian.co.uk/brian it
actually calls www.brian.co.uk/user.php?username=brian or what ever
variable is set as $1, I'm not sure what the L,QSA mean but I could
google that bit :-)

Now this works fine for me with a username of brian but if someone like
john.smith tries to login they get a 404 error.

Is it possible to alter the rewrite rule to allow periods ?

There are only two people who login without the period (me & one other
tech) so if the rule can only allow dotted usernames that's not a
problem as I can alter how the two of us login.

Thanks
Brian

------------------------------------------------------------------------------------------------
    The views expressed here are my own and not necessarily


                the views of Portsmouth College