Support » Fixing WordPress » Redirecting Drupal ?q=/node/ to WordPress item

  • Hi all,

    I’m about to do the big switch from Drupal to WordPress. I have a handful of popular Drupal nodes that I’d like to have redirect to their WordPress equivalent. Could someone share with me the best way to put together an .htaccess file that could accomplish this?


Viewing 7 replies - 1 through 7 (of 7 total)
  • Search for .htaccess in Google for how to set up rules for redirection. I found this very quickly:

    I’ve been searching all day and that was the first link I found. Unfortunately a simple re-direct in the .htaccess won’t do the trick here since the parameter ?q=node/## needs to be converted to ?p=## on the WordPress side.

    Moderator Jan Dembowski


    Brute Squad and Volunteer Moderator

    Same root directory? If the numbers line up (good luck with that 🙂 ) try

    RewriteRule ^?q=node/(.*)$1 [R=301,L]

    If the numbers are different (such as drupal number is 17 and WordPress post number is 54) try this

    RewriteRule ^?q=node/17 [R=301,L]

    Give that a shot and good luck.

    PS. Backup, backup, backup your .htaccess file on the off chance you fat finger something…

    I have a similar problem. jdembowski, if I try your code like this:

    RewriteRule ^?q=services [R=301,L]

    I get a 500 Internal Server Error. If I add the “/” like this:

    RewriteRule ^/?q=services [R=301,L]

    it takes me to the homepage. Any ideas? I also tried this:

    RedirectMatch permanent ^/?q=services$

    but got the same result.

    I’ve got one here that seems to work for me. Only took me about eight hours and a couple dozen google searches.

    RewriteCond %{QUERY_STRING} ^q=node/(.+)$
    RewriteRule ^(.*)$ [R=301,L]

    It turns out that you need the RewriteCond to match the query string – RewriteRule won’t do it. Then, in the RewriteRule line, you use %1 instead of $1 to pick up the first match from RewriteCond rather than the match in RewriteRule.

    I’m really glad this finally worked for me, but I really hate working with htaccess.

    Thanks to the previous poster, this is EXACTLY what I was after!

    I’m having a similar issue, or at least I think I think so.

    I have a gallery that no longer exists and want to forward people coming in to those URLs to the tag for gallery.

    As an example, one URL ends with: ‘/gallery/displayimage.php?pos=-653’
    And I want to send people to: ‘/tag/gallery/’

    I’ve been trying everything, but nothing works. Any suggestions how I can adapt the previous example to work for me?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Redirecting Drupal ?q=/node/ to WordPress item’ is closed to new replies.