I'm trying to redirect some old urls to the new Drupal ones with .htaccess rules.

This works

Redirect 301 /oldurl http://mysite.com/new-url

But this gives me a Drupal error

Redirect /people/details.aspx?id=1234 http://mysite.com/name-surname

Is it possible to perform a redirect like this?

The errors I get are

Warning: array_flip() expects parameter 1 to be array, string given in DrupalDefaultEntityController->load() (line 178 of /var/www/includes/entity.inc).

Warning: Invalid argument supplied for foreach() in DatabaseCondition->compile() (line 1854 of /var/www/includes/database/query.inc).

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT revision.vid AS vid, base.uid AS uid, revision.title AS title, revision.log AS log, revision.status AS status, revision.comment AS comment, revision.promote AS promote, revision.sticky AS sticky, base.nid AS nid, base.type AS type, base.language AS language, base.created AS created, base.changed AS changed, base.tnid AS tnid, base.translate AS translate, revision.timestamp AS revision_timestamp, revision.uid AS revision_uid FROM {node} base INNER JOIN {node_revision} revision ON revision.vid = base.vid WHERE (base.nid IN ()) ; Array ( ) in DrupalDefaultEntityController->load() (line 196 of /var/www/includes/entity.inc).

My new rules begin before the Drupal rules of

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

As suggested I have tried redirecting to non clean URLS. This works

Redirect 301 /oldurl http://mysite.com/?q=new-url

But the URL stays as that which isn't any good as there will then be duplicate URLs of http://mysite.com/?q=new-url http://mysite.com/new-url

I tried

Redirect 301 /people/details.aspx?id=1234 http://mysite.com/?q=name-surname

But I still get the same errors as before

  • What Drupal error? And are these lines the only thing before Drupal's own .htaccess directives?
    – Mołot
    Aug 21, 2013 at 7:39
  • Wait, what? When you go directly, there are no errors, but when you go with redirect, they are? But the redirect itself points you to a proper URL?
    – Mołot
    Aug 21, 2013 at 8:01
  • If I go to a Drupal created page e.g mysite.com/about-us it displays fine. A redirect rule of Redirect /oldpage mysite.com/new-page Also works and displays the new page fine I do have a Drupal created page of /people but my understanding is the htaccess redirect should kick in first so /people/details.aspx?id=1234 would not be handled by Drupal but instead be redirected to a page by htaccess
    – ianckc
    Aug 21, 2013 at 8:22

1 Answer 1


I've experienced that in Drupal 7 you must not rewrite to a clean URL destination, even if you have clean URLs enabled.

(This is possibly a duplicate of: Rewrite URL not working.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.