Archive for category Technology

WordPress Blogs : How to to put a 301 redirect in the .htaccess file

You put the 301 redirect commands at the very top of the the .htaccess file. Example : this blog! You need the 301 redirect commands if you have two domain names like emsjuwel.com and www.emsjuwel.com and you want everybody to be sent to just one of them automatically.

There are many blog posts about the 301 redirect. I didn’t find them very helpful. So, here is how we installed the 301 redirect into the .htaccess file for this WordPress 2.9.2 blog that you are reading!

How to check if you have a 301 redirect for your site!

Go to a free redirect checking site like InternetOfficer.com and test your web site domain names.

http://www.internetofficer.com/seo-tool/redirect-check/

Just type in the name of the domain that you wish to check and press the button ‘Check Redirects‘.

For instance, we redirect all traffic from www.emsjuwel.com to emsjuwel.com (most sites do it the other way around ie from theirsite.com to www.theirsite.com) If your redirect test shows something like the following then you already have a 301 redirect and you have no work to do :

Response
Checked link: http://www.emsjuwel.com
Type of redirect: 301 Moved Permanently
Redirected to: http://emsjuwel.com/

How to check your version of WordPress quickly

First and very important : there is an important 301 related bug in older versions of WordPress. A canonical 301 redirect in the .htaccess file would cause an endless loop! Yikes! This bug was fixed for WordPress versions 2.7 and above.

You can get a quick overview of WordPress bug fixes and releases at Softpedia (scroll down the page to ‘What’s new in WordPress 2.7′ and read the section marked Bug Fixes):

http://webscripts.softpedia.com/scriptViewChangelog/WordPress-Changelog-165.html

So, you will need to check which version of WordPress you are using. If you wish to check this without logging into your web site then :

  1. Use your browser to go to your web site home page and then
  2. Use the View->Page Source (in the top menu of your browser) to see the source code for your web page.
  3. You should see the WordPress version in the first 20 lines on your screen (approximately!) The version number will look something like this : name=”generator” content=”WordPress 2.9.2″

How to check if you can modify your .htaccess file

You might not be able to modify your .htaccess file at all! You will need to ask your web site hosting company if you can do this! Here are a couple of sample emails that you can send to their technical support :

Example 1. Redirecting from www.yourdomain.com to yourdomain.com

Here is a sample email that you can send them (redirect all web page requests for www.yourdomain.com to yourdomain.com).

You can just copy and paste this into an email message.

Dear My Web Site Hosting Company;

I would like to add a canonical 301 redirect from www.yourdomain.com to yourdomain.com. I would like to add the following lines to the very top of my .htaccess file.

Question 1: Will this work?

Question 2 : How can I actually edit and install the .htaccess file?

# BEGIN Website redirect
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]
</IfModule>
# END Website redirect

Example 2. Redirecting from yourdomain.com to www.yourdomain.com

And here is a sample email that you can send them (redirect all web page requests for yourdomain.com to www.yourdomain.com):

Dear My Web Site Hosting Company;

I would like to add a canonical 301 redirect from yourdomain.com to www.yourdomain.com. I would like to add the following lines to the very top of my .htaccess file.

Question 1: Will this work?

Question 2 : How can I actually edit and install the .htaccess file?

# BEGIN Website redirect
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
</IfModule>
#END Website redirect

How to change your .htaccess file on your server

This is the trickiest part of the average person : As part of the answer to your email (above), your web hosting company will tell you how to make the changes to the file.

They will probably say something handy like : “Oh, just log on to your web site, grab a copy of the existing .htaccess file, MAKE A BACKUP COPY IN CASE YOU MAKE A MISTAKE, edit the .htaccess file and FTP the modified file back in with overwrite.”

Cheerfully, they will forget to mention a few little details like this : .htaccess is a rather odd file name that your computer might not like very much because it starts with a period. Stuff like that.

If so, you will need to give them a phone call and have them explain things step-by-step while you do the actual edit and file transfer. It’s not very complicated or time consuming.

Or, you get some computer geek to install the file for you. Computer techies can do this in less than 5 minutes start to finish (once they have the OK for the above email from your web site hosting company). The longest part will be typing in your password!

How to see if your new .htaccess 301 redirect is working

After you have installed the .htaccess file then you can check if your redirect is working by using the web site at the top of this post again (InternetOfficer.com).

Thank you to InternetOfficer.com for providing a nice free redirect checker!

, ,

No Comments

Web site owners : tracert and the DCHP loop problem on the Internet

Three days of debugging the Internet! Everybody could access our web site except us! Webmasters : here is what caused the bug.

On Sunday we could not get access to this web site and we could not access the email for this web site. We could access any other web site but not our own! On top of that : everybody else could access our web site. Last but not least, we could get access to our web site using the free online proxy server at kroxy.com (the big clue!).

The message we got from our Firefox browser was ‘Server not found. Firefox can’t find the server at emsjuwel.com’. The message we got when checking our email was ‘Connection refused’. Our FTP software worked just fine.

We have our computers, our routers, our modems, our ISP, our web page hosting service and all the computers and transmission lines in-between!

Not one of the technical people had ever heard of this problem. So, time to find that Internet bug!

I can’t get access to my web site or my email !

The main point : if you are having trouble accessing your web site and your email from your web site then you should send a “tracert” (traceroute) for your web site to your ISP. On the phone, they can explain how to get a tracert from your computer to your web site and you can send a copy by email (it’s very simple). You can see a few details on how to use traceroute and tracert at the bottom of this blog post.

What is a DCHP address conflict and looping?

This is the explanation I was given (and I hope I understood it correctly!).

First, it had nothing at all to do with our web site hosting service.

Our ISP (the company that provides our modem connection to the Internet) and another company were accidentally assigned and using the same range of DCHP addresses. This would cause a 3-step loop and cancel. In simple terms : the request from our computers to visit our web site would end up going back and forth between our ISP and the other company 3 times before the request would get cancelled.

When our ISP discovered the problem : they simply (and very quickly) made certain that the DCHP ranges they use were different than the DCHP ranges of the other company.

The bottom line : We hope that this will save you 3 days of debugging if you have trouble accessing your web site!

Important web site and email problems to test and check

  1. You have no access to a web site and no access to the email of the web site (for instance – your own web site!)
  2. You can visit other web sites without any problem
  3. You can visit the problem web site by using a “proxy server” (like the free web page at kroxy.com)
  4. Your ISP (the company that provides your Internet connection) tells you that your modem is working fine
  5. Techies only : you can access the web site using an FTP software (not the FTP client built into your browser) without any problem

If the above is true then make sure to call your ISP right away so that they can tell you how to do a tracert (it’s very simple) and send it to them.

How to get help with the tracert (traceroute) command

Do not check your Browser or your Router or your Modem or your Web Hosting Service as the first step. Call your ISP first and make certain that they are not having a routing problem!

You do not need to understand anything about tracert. On the phone, they will explain how to get a tracert, how to copy the tracert it and how to email the tracert to them. It is very simple.

Also : It might be a good idea to tell them about this blog post. Their technical people might find it useful.

Finally, if you know somebody who has a web site then they might be interested in knowing about this kind of potential problem. Knowing about it ahead of time may end up saving them 3 days of extremely technical Internet debugging work!

How to use tracert on Windows computers

Here is a link to an article about the tracert command from Indiana University

http://kb.iu.edu/data/aihy.html

How to use tracert on Ubuntu computers

In Ubuntu you will need to be sudo to run tracert from the terminal.

(don’t worry – Ubuntu people know what this is!)

http://manpages.ubuntu.com/manpages/hardy/man8/lft.db.8.html

If you find that you can’t access your web site and you can’t access your web site email but you can access your web site over a proxy server like kroxy.com then make certain that your ISP checks this routing problem first (and not last!).

, , ,

No Comments