Re: .htaccess {QUERY_STRING} and issue with append a value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Joydeep,

Zitat von Joydeep Bakshi <joydeep.bakshi@xxxxxxxxxxxxxx>:
On 24-May-2013, at 6:23 PM, Jens-Uwe Mozdzen <jmozdzen@xxxxxx> wrote:

Hi Joydeep,

Zitat von Joydeep Bakshi <joydeep.bakshi@xxxxxxxxxxxxxx>:
On 24-May-2013, at 6:06 PM, "Jens-U. Mozdzen" <jmozdzen@xxxxxx> wrote:

Hi Joydeep,

Zitat von Joydeep Bakshi <joydeep.bakshi@xxxxxxxxxxxxxx>:
[...]
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@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux