Re: [Hampshire] mod_rewrite

Top Page

Reply to this message
Author: Brian Chivers
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] mod_rewrite
Chris Dennis wrote:
> Brian Chivers wrote:
>> Keith Edmunds wrote:
>>> On Thu, 20 Nov 2008 18:52:23 +0000, brian@??? said:
>>>
>>>
>>>> RewriteRule: cannot compile regular expression '^([^/\\]+)?/?$'
>>>>
>>> Sorry, I should have removed the backslash that was before the dot too:
>>>
>>> RewriteRule ^([^/]+)?/?$ user.php?username=$1 [L,QSA]
>>>
>>>
>> :-) That sort of worked but I just get a blank page with user not found
>> error, where as normally I get a full page so I'm guessing it's
>> stripping something off.
>>
>> Guess I'll have to contact the support forum for the people who wrote
>> the software & ask them if they've got a work around as I don't really
>> know how it all works together and the php files are all Zend encoded :-/
>>
>> Brian
>
> Do you have sufficient access to the server to be able to see
> mod_rewrite's log files (which can be enabled with 'RewriteLog' if
> necessary)? If so, you can debug the process to see what your regexp is
> actually doing.
>
> mod_rewrite rules involve a lot of trial and error in my limited experience.
>
> You could try it without one of the ?s, since if it doesn't match, the
> rule shouldn't get invoked anyway:
>
> RewriteRule ^([^/]+)/?$  user.php?username=$1    [L]

>
> You don't need QSA if you're not expecting '?...' on the end of the URL
> before the substitution occurs.
>
> Another untested thought: does the '.' in the username need to be
> escaped, i.e. converted to %2e ? Don't ask me how though...
>
> Good luck
>
> Chris


I have complete access to the server as it's one I built so that's not a problem :-)

What I'll try to do over the weekend is enable the rewrite log & have a play & see what I find.

Brian

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


                the views of Portsmouth College