I am moving a site, from old PHP only site to Drupal.
So I am trying to get 404 for the url so I can have it in admin and make a redirect. So I am accessing new drupal site, with old query like

https://develop.example.com/de/staticPage.php?page=customerCare&service=...

but system only registers

https://develop.example.com/de/staticPage.php

so I cant make redirects as I dont know which query it was. My plan was to hit the site with hundreds of old queries and then make redirects for them (there are no possible patterns that match old and new so I can only do it like that) but this will not work as system only gets base of url.

CommentFileSizeAuthor
#6 fetch_language_404-2458325-6.patch1.86 KBMarko B

Comments

Marko B’s picture

Also Language is not respected, so when I call something with language prefix like

https://develop.example.com/de/staticPage.php

404 list reports like https://develop.example.com/staticPage.php was visited, so there is no way of knowing which language had 404.

Marko B’s picture

Title: Module doesnt fetch full query, just the base in attempt to list it in 404 » In attempt to list path in 404, module doesn't fetch full query, just the base
Marko B’s picture

Also, if you have a url that was in subdomain like in

https://de.example.com/staticPage.php

and you want to move it out of subdomain like

https://example.com/de/staticPage.php, then you cant, as base part of URL is hard fixed.

Marko B’s picture

Title: In attempt to list path in 404, module doesn't fetch full query, just the base » Doing redirects from non Drupal site. In attempt to list path in 404, module doesn't fetch full query, just the base
Issue summary: View changes
Marko B’s picture

So most of this is because redirect is using data from watchdog "message" field, which is missing all the other info, for example

TYPE	page not found
DATE	Tuesday, March 24, 2015 - 22:24
USER	setup
LOCATION	https://example.com/de/careers.php?type=2&cid=1
REFERRER	
MESSAGE	careers.php
SEVERITY	warning
HOSTNAME	88.207.113.4
OPERATIONS	

so location field has full URL data, the message has just minimal data. I know that more parsing would be needed in "location" case, but it could also offer more features.

Marko B’s picture

StatusFileSize
new1.86 KB

I made a patch that will get language prefix from 404 URL from "location" field in watchdog table. Then add it to list in 404 admin. Also when you click redirect it will use this language as preselected from drop down in the list so you can quickly make proper language redirect.

Marko B’s picture

Status: Active » Needs review
chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The patch in #6 is 4 years old and no longer applies to the latest 7.x-1.x-dev and may be too old to reroll, but I'll add the issue tag anyway.

fetch_language_404-2458325-6.patch:28: trailing whitespace.
    
Checking patch redirect.admin.inc...
Hunk #1 succeeded at 764 (offset 65 lines).
error: while searching for:
  $query->fields('w', array('message'));
  $query->addExpression('COUNT(wid)', 'count');
  $query->addExpression('MAX(timestamp)', 'timestamp');
  $query->leftJoin('redirect', 'r', 'w.message = r.source');
  $query->isNull('r.rid');
  $query->condition('w.type', 'page not found');

error: patch failed: redirect.admin.inc:713
error: redirect.admin.inc: patch does not apply
Marko B’s picture

That is story of my life on d.org. I have dozens of patches nobody looks at until it passes few years and then this happens. Something is broken here.

chris matthews’s picture

I understand and agree with you. There is ton of great contrib patch code 'out there' for D7, which is why I felt it is worth attempting to resurrect as many old issues as I could in hopes that at least a small percentage will eventually get committed and it appears to be working to some degree. Here are a few examples from the xmlsitemap module:

#2831778: Sitemap file size increase for Google and Bing
#2545050: Dont write empty element in xml sitemap file
#2307573: Modal not working
#2831500: Arabic Language encoding

Marko B’s picture

Good luck, hope you make the most of it.

wylbur’s picture

Status: Needs work » Closed (outdated)

Closing this as Outdated as Drupal 7 is EOL.