301 Redirect Drupal to WordPress

301 Redirect Drupal to WordPress

Just having converted my website over to WordPress from Drupal,
the one thing I wanted to do was to keep my rankings for some of my old posts by making sure I redirected my old Drupal links to my new WordPress links.  This is how I was able to accomplish this with 301 Redirect.

301 redirect

For those of you not familiar with the URL formats of Drupal, your basic link is http://www.example,com/?q=node/xx, where xx is the ID of the post / page.  For WordPress, your basic link is http://www.example.com/?p=xx, where xx is the ID of the post / page. Seems like a pretty basic problem to resolve with some .htaccess rewrite rules.

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on

# Rewrite Drupal URLs to WordPress
# Drupal form ?q=node/11 to WordPress form ?p=11
RewriteCond %{QUERY_STRING} ^q=node/(.+)$
RewriteRule ^(.*)$ http://kylestubbins.com/?p=%1 [R=301,L]

</IfModule>

Done. Simple. We grab the QUERY_STRING (everything after the ?) and then grab the number from the end, if it matches our pattern of q=node/xx, rewrite it to our WordPress format and give a 301 Redirect.

So I go to Google, do a site search and check some links.  404 errors. What?   Seems I forgot about Drupal’s clean URLs, which is using the format of http://www.example.com/node/xx.  Again, no real big deal. We just need another re-write rule.

But wait!  Where is our QUERY_STRING? We don’t have one with our clean URLs.  Not to fret, we can use the REQUEST_URI and do a RegEx test on that.  Our conditional test for this is;

RewriteCond %{REQUEST_URI} ^/node/(.+)$

This time, we are looking for a match on the form “/node/xx” (without the quotes), we still grab the page ID (the xx part) and do the same rewrite as we did the first time.

RewriteRule ^(.*)$ http://kylestubbins.com/?p=%1 [R=301,L]

We can add this rewrite condition below the first condition and above the actual rewrite rule, like so;

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on

# Rewrite Drupal URLs to Wordpress
# Drupal form ?q=node/11 to WordPress form ?p=11
RewriteCond %{QUERY_STRING} ^q=node/(.+)$
RewriteCond %{REQUEST_URI} ^/node/(.+)$
RewriteRule ^(.*)$ http://kylestubbins.com/?p=%1 [R=301,L]

</IfModule>

Now, it doesn’t matter which form the URL comes in as, they are both rewritten to the the new WordPress form.  Both of these links will redirect back to this post;

http://kylestubbins.com/?q=node/498
http://kylestubbins.com/node/498

So, why does the URL for this post show up as http://kylestubbins.com/301-redirect-drupal-wordpress and not http://kylestubbins.com/?=498?  That’s the WordPress Permalinks system at work!

 

Welcome back

Hello, and welcome back to KyleStubbins.comkyle_s4h_avatar! Reading the last posts I put up here, I have a lot of updating to do! It’s been a while since I’ve posted here, so let’s get the ball rolling.

I put this site up originally because it always makes me happy when I can help someone learn through my experiences. I learn a lot from those who post on the internet – I’m just trying to pay if forward.

What can you expect to find here in the near future? All kinds of interesting things, such as cars, computers, electronics, programming, Android, WordPress and anything else that flows through my head.

So, I think I’ll make this post short and sweet, instead of trying to update you here, with the last four years. I’ll be making a few posts over the next few days to update you on some of my past posts and projects. Then, we’ll get into the current stuff.

I have just converted my site over to WordPress, from Drupal, so please bear with me while I learn a new system and spend a little time setting it up properly. I’ve got a few issues to deal with, mostly in redirecting old URLs to new ones.  If you have any tips on setting up WordPress, or have found issues with the new site, your comments are welcome and appreciated!

4×4 not working

ok i had the shop check my 2001 4×4 because the lights on switch blinking and they said encoder motor bad 600$ to fix so i found one and fixed myself and rest comp.. and lights work – encoder motor works – vac. lines work - every thing seems to work but front wheels are not pulling. i lifted front up and turned wheels by hand to see if in 4wh and they turned front axle,moved out of 4wh and wheels moved free. so if 4wh engages but doesnt work what is it, i called shop they said maybe front axle clutch sleeve . help please

2001 blazer

THANKS FOR ALL THE INFO!!

Let me begin by saying that your site is the most informative that I found by far when I was trying to fix the 4WD on my 99 S-10. My situation was that when I pushed the 4HI button the light came on but no 4WD. With information from your site I replaced the vacuum switch on the transfer case, which was bad, almost fell apart when removed and still no 4WD! Then replaced the vacuum actuator which had a hole in the bladder and all is now well right? Wrong! Pushed the 4HI button and fuses blew, the dash went haywire and still no 4WD! The 4WD activation light switch was a dead short! I disconnected it and replaced the fuses and voila, 4WD! WooHoo! I replaced the actual switch a few days later when it had warmed up a bit and everything works fine now. Also found that the exhaust can burn holes in the vacuum lines. Fixed two of those and secured the lines away from the heat. The way I found it was that I didn’t touch anything electrical and that’s the only electrical part that pulling the 4WD cable can activate. I now have one of each part in my truck with some vacuum line and splices just in case and I would recommend this to any S-10 4WD owner! It may not be practical to change out in a ditch in the cold but it beats getting stuck or getting in an accident. I laid in the snow for three days working on mine but after you do it once it’s really pretty easy. I sincerely thank you for the help that your site provided and hope that my info can help someone as well.
PS: I took my TCCM apart and to my amazement it was pristine on the inside! I at least had a bit of good luck. Thanks again, JM.

Dodge Nitro Steering Column Repair

Seeing as I haven’t posted much here in a while, I’ll start things off again with a repair that I did to my 2007 Dodge Nitro today…

2007 Dodge Nitro 4x4 SLT

About a month ago I noticed that my steering wheel was starting to have up and down “play” in it, which seems to have gotten worse this past week. So, today, I decided I’d Google it in case it had already been discussed elsewhere.

Well, that payed off with this thread on nitroforumz.com. What was also noted there was a clicking sound coming from the steering wheel / column — something I had noticed since driving my Nitro off the lot in April 2007. Something that I simply wrote off because it sounded like a spring clicking inside the column, which could have been normal.

Anyway, to make a long story short, here’s some images of how the repair was done (click on any image for a larger view);

Continue reading

S10 4.3 Vortec ZR2 Stumble / Hesitates Just After Taking Off

I have a 99 S10 that I just bought a few weeks ago. My wife was hesitant letting me get a new toy, but caved as long as it was a good deal and didn’t have to put much money into it. I love this truck, can’t believe I almost looked at a Ford. Got the 4WD working great now, and a tranfer case leak taken care of, but still hesitating.

Starts great, but if you drive away right away, it stumbles in that first block or two, then it acts like you flipped a switch and runs great from then on. Does this every single time after starting it, so I can’t start and dart into traffic or I get “the looks” for people. I found that if I just start it and let it idle for a minute or two before going, then it seems to be better.

I’m not getting any DTC codes. I don’t have a fuel pressure gauge, and really don’t want to do parts shotgun replacement. The way it seems to click in and then go fine seems like a give away, just not giving it away to me.

Any thoughts from anyone?

Help with 98 blazer

I appreciate your time. I recently bought a 98 blazer. When I bought it, the four wheel drive would not lock in. I thought with my great knowledge it would nothing to repair but I was wrong, dead wrong. When I got it home, the front drive shaft is locked in all the time, and the front axels turn but, when you jack all 4 tires up on jack stands and put it in gear they do not turn. When you push the 4×4 button on the dash it blinks a few times and then goes out. The TCCM on the passenger floor board clicks but stops. I have changed the switches in the dash, still no good. I changed the vaccuum servo under the battery. I read your advice to someone else I checked for corrosion on the TCCM plug in, it looked good and I saw no corrosion. I tried a different TCCM box with still no results. So next I thought it had to be the only part left was the 4×4 acutuator motor on the transfer case. I have checked all vaccuum hoses and I found nothing out of the ordinary. It will not go into 4lo either. If you have any ideas that could help me out I would greatly appreciate it.
Thanks,
Jeff

95 s10 zr2 auto floorshift 4wdl not engaging

my indicator lights on the floorshift console are not on.
but the 4wdh works fine and the 4wdl doesnt. it engages at low speeds and for some reason when i gas it more,it feels like the motor just revs but when the idle goes back to low it starts to engage again? can someone give me input pls….

more about my problem

Have a 1999 4.3 chevy blazer. have replaced spark plugs, fuel filter, air filter, egr valve. engine runs fine gets satisfactory gas milage. My problem is the initial start. Engine rumbles upon on start-up. Like the whole engine shakes. Engine always starts and runs fine but the initial start is always rough. when you shut the engine off it does the same thing. Some times worse than other. Any suggestions why this is happening? More of an annoyance than anything.

chevy blazer power problems

Yes my name is kyle and I have a 1999 chevy blazer 4×4 and i have the same tccm problems like everybody else but my only problem is that i need the new 32 pin femal plug and the 4pin female cause my tccm is in working condition. I can’t find then plugs and wires anyplace :) i know what are odds there. My second problem is that if my blazer sits for a few days and doesn’t get started it doesn’t want to start and you have to spray starter fluid in the vac line on the throttle body and also with that when you go to give extra gas for say highway or pulling out infront of a person the blazer falls on it’s face. I have replaced the plugs twice, wires twive, coil pack twice, and had oil change and tranny flush(and tested) fuel pressure is good. no servive engine light or service 4×4 either! please help me somebody!