WordPress.org

Support

Support » How-To and Troubleshooting » Redirecting Drupal ?q=/node/ to WordPress item

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?

    -Lon

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:
    http://www.javascriptkit.com/howto/htaccess7.shtml

    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.

    Jan Dembowski
    Volunteer Mod. & Brute Squad

    @jdembowski

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

    RewriteRule ^?q=node/(.*) http://your.blogurl.com/?p=$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 http://your.blogurl.com/?p=54 [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 http://my.blogurl.com/services [R=301,L]

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

    RewriteRule ^/?q=services http://my.blogurl.com/services [R=301,L]

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

    RedirectMatch permanent ^/?q=services$ http://my.blogurl.com/services

    but got the same result.

    dlambert@appdev.info
    Member

    @dlambertappdevinfo

    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 ^(.*)$ http://www.yoururlhere.com/?p=%1 [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.

    Joe Hawes
    Participant

    @morehawes

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

    GATEKeeper
    Member

    @gatekeeper

    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.