Forum Moderators: phranque

Message Too Old, No Replies

How to trap and redirect [callbacks]

         

superjacent

4:11 am on May 17, 2008 (gmt 0)

10+ Year Member



I thought I had a handle on re-directs but I can't get my head around this one. I'm going around in circles.

Checking my recent log entries at my site, it reveals that I'm getting a lot of 'Page Not Found' errors and the offending URL's are similar to this:-

http://example.com/taxonomy/term/drupal/?_menu[callbacks][callback]=http://www.example.com/folder/filename.txt?

Everything from the "?_menu" on is crap and false. How do I trap for this and redirect to another page. This is what I've tried so far but doesn't work (and then a heap of variations):-

RewriteCond %{QUERY_STRING} ^\?_menu\[callbacks\]
RewriteRule ^$ http://example.com/node/89? [R=301, L]

Any help appreciated.

[1][edited by: engine at 7:22 am (utc) on May 17, 2008]
[edit reason] examplified [/edit]

jdMorgan

2:09 pm on May 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The question mark that demarcates the query string from the URL will appear in neither the %{QUERY_STRING} variable nor the URL-path examined by RewriteRule. Remove the question mark from your pattern.

Jim

superjacent

3:07 pm on May 17, 2008 (gmt 0)

10+ Year Member



Thanks for advice.

Removing the question mark has at least stopped the internal server errors occurring.

Writing these lines doesn't appear to work, I still get a 'page not found' error and the url in the address bar hasn't changed.

RewriteCond %{QUERY_STRING} ^_menu\[callbacks\]
RewriteRule ^$ http://example.com/node/89? [R=301, L]

jdMorgan

3:50 pm on May 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may need to represent the "[" and "]" characters as URL-encoded entities, such as "\%5b" and "\%5d" in your pattern -- I'm not sure, but that's a possible cause.

Jim

superjacent

2:11 am on May 18, 2008 (gmt 0)

10+ Year Member



Hate to say this but that's not working either. Even reducing the criteria to this, doesn't work.

RewriteCond %{QUERY_STRING} ^_menu
RewriteRule ^$ http://example.com/node/89? [R=301,L]

With the above, I'm getting Internal Server Errors and yet last night when checking (removing the question mark as advised in previous message) I was at least getting 'page not found' errors.

jdMorgan

2:40 am on May 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What is in your server error log file?
(You may need to add
Options +FollowSymLinks

ahead of your code if you see a message mentioning it in the error log)

Where is this .htaccess code located? (should be in http://example.com/taxonomy/term/drupal/.htaccess)

Jim

superjacent

3:45 am on May 18, 2008 (gmt 0)

10+ Year Member



It does follow symlinks in the .htaccess file.

The .htaccess file is at the root, where index.php file is.

There is no sub-directory /taxonomy/...

I'm in the process of seeking advice from my host re - the server logs.

My application is Drupal a Content Management System. I've got clean url's enabled (I believe it's also known as static url's).