httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens-U. Mozdzen" <jmozd...@nde.ag>
Subject Re: [users@httpd] .htaccess {QUERY_STRING} and issue with append a value
Date Fri, 24 May 2013 13:14:55 GMT
Hi Joydeep,

Zitat von Joydeep Bakshi <joydeep.bakshi@netzrezepte.de>:
> On 24-May-2013, at 6:23 PM, Jens-Uwe Mozdzen <jmozdzen@nde.ag> wrote:
>
>> Hi Joydeep,
>>
>> Zitat von Joydeep Bakshi <joydeep.bakshi@netzrezepte.de>:
>>> On 24-May-2013, at 6:06 PM, "Jens-U. Mozdzen" <jmozdzen@nde.ag> wrote:
>>>
>>>> Hi Joydeep,
>>>>
>>>> Zitat von Joydeep Bakshi <joydeep.bakshi@netzrezepte.de>:
>>>>> [...]
>>>>> Thanks but without the leading slash it still fails to provide  
>>>>> the redirection.
>>>>> Now I have
>>>>>
>>>>> RewriteRule ^ALP33211$  /ALP33211&L=1 [R=301]
>>>>
>>>> what's in mod_rewrite's debug log?
>>>>
>>>> Regards,
>>>> Jens
>>>>
>>>>
>>>
>>> Hello Jens,
>>>
>>> I get repeated
>>
>> sorry, I missed the other response.
>>
>>>
>>> `````````````
>>> applying pattern '^ALP33211$' to uri
>>>
>>> ``````````````
>>
>> That's not very helpful yet - increase the log level so you see  
>> that a new request is being handled and which rules apply and which  
>> don't - "RewriteLogLevel 5" might be a good start.
>
> It was level 5 and now I have set level 9.
> From log it seems that the pattern is blindly applied to every link  
> rather than matching the query_string

that's not how I read it:

> applying pattern '^ALP33211$' to uri 'index.php'
> applying pattern '^ALP33211$' to uri  
> 'uploads/repository/02/1276_cn74_1001.gif'
> applying pattern '^ALP33211$' to uri  
> 'fileadmin/templates/images/btnAddCart.png'
> ……..
> ….
>
> where te ruleset I have at .htaccess is
>
> RewriteCond %{QUERY_STRING} ^Id=7572&doi=10.5414/ALP33211$
> RewriteRule ^/ALP33211$  /ALP33211&L=1 [R=301]

The first rule to check is "does the URI match "^/ALP33211$"? And  
that's of course applied to all incoming requests, which is what the  
debug log confirms.

> The actual url is    
> http://www.mydomain.com/index.php?id=7&artId=7572&doi=10.5414/ALP33211

Then where does your regexp "^/ALP33211$" come from? Shouldn't you  
rather match "^index.php$"?
RewriteCond is just *another* condition the request has to match. And  
make sure your replacement string is correct - as it is now, you  
defined to turn "/ALP33211" (which will never match - no leading  
slash, please) to "/ALP33211&L1"... even if you fix the condition, the  
replacement looks wrong to me ;)

> and it has to become
>
> http://www.mydomain.com/index.php?id=7&artId=7572&doi=10.5414/ALP33211&L=5

hm... might it be you got confused by the format of the query  
parameters? The final element of the resource is "index.php",  
everything after the "?" are parameters. Seems that's where your  
current regexp comes from.

Watch your debug log - it tells you what URI is being thrown into the  
rule sets - the first one from your quote above is "index.php", and  
it's that URI which needs to be matched in RewriteRule.

> The &L=5 has to be appended
>
> Thanks

Regards,
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message