.htaccess 301 redirect problem for non-www in Plesk

Must Read : .htaccess 301 redirect problem for non-www in Plesk

A frustrating problem when trying to get .htaccess redirecting from a non-www domain to the www left me scratching my head for ages. I knew the .htaccess file was fine – had triple checked the code and uploaded the file to the website httpdocs root, but for some strange reason any redirect rules set for the non-www version of the domain did not work at all.

The code for the .htaccess non-www 301 redirect is as follows:

Eventually I found the root of the problem. On Plesk (Plesk 11), I had somehow managed to create incorrect DNS settings. When I had setup the domain in the Plesk control panel, I inserted the full domain including the www i.e. www.webdevdoor.com when I should have entered webdevdoor.com. This caused ‘www’ to appear unnecessarily in all the DNS settings.

As the non-www was not defined properly in the DNS, it did not correctly interpret the non-www redirect rules set in the .htaccess file and showed me the Plesk holding page instead.

To fix the problem, under websites & domains, select the domain and under the ‘general’ tab, make sure your domain is set as non-www – i.e. example.com instead of www.example.com. Check the DNS settings again (under websites & domains) and all but the last entry should now have the ‘www’ omitted.

12 Best Quote’s on Programming

Must Read : 12 Best Quote’s on Programming

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals.”
Jon Ribbens

“Beware of bugs in the above code; I have only proved it correct, not tried it.”
Donald E. Knuth.

“People think that computer science is the art of geniuses but the actual reality is the opposite, just many people doing things that build on each other, like a wall of mini stones.”
Donald Knuth

“First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.”
– George Carrette

“Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program.”
Linus Torvalds

“There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.”
C.A.R. Hoare

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning.”
Rick Cook

A program is portable to the extent that it can be easily moved to a new computing environment with much less effort than would be required to write it afresh.
W. Stan Brown
The computing scientist’s main challenge is not to get confused by the complexities of his own making.
E. W. Dijkstra
“Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’”
Steve McConnell

“A language that doesn’t affect the way you think about programming is not worth knowing.”
Alan J. Perlis

“The most disastrous thing that you can ever learn is your first programming language.”
Alan Kay

HTTP Error Code List

Must Read : HTTP Error Code List

This article will give you some basic knowledge about how many http error you can get and which error stands for what reason.

Here is the full list of errors

  1. 100 Continue
  2. 101 Switching Protocols
  3. 102 Processing
  4. 200 OK
  5. 201 Created
  6. 202 Accepted
  7. 203 Non-Authoritative Information
  8. 204 No Content
  9. 205 Reset Content
  10. 206 Partial Content
  11. 207 Multi-Status
  12. 208 Already Reported
  13. 226 IM Used
  14. 300 Multiple Choices
  15. 301 Moved Permanently
  16. 302 Found
  17. 303 See Othes
  18. 304 Not Modified
  19. 305 Use Proxy
  20. 306 Switch Proxy
  21. 307 Temporary Redirect
  22. 308 Permanent Redirect
  23. 308 Resume Incomplete
  24. 400 Bad Request
  25. 401 Unauthorized
  26. 402 Payment Required
  27. 403 Forbidden
  28. 404 Not Found
  29. 405 Method Not Allowed
  30. 406 Not Acceptable
  31. 407 Proxy Authentication Required
  32. 408 Request Timeout
  33. 409 Conflict
  34. 410 Gone
  35. 411 Length Required
  36. 412 Precondition Failed
  37. 413 Request Entity Too Large
  38. 414 Request-URI Too Long
  39. 415 Unsupported Media Type
  40. 416 Requested Range Not Satisfiable
  41. 417 Expectation Failed
  42. 419 Authentication Timeout
  43. 429 Too Many Requests
  44. 500 Internal Server Error
  45. 501 Not Implemented
  46. 502 Bad Gateway
  47. 503 Service Unavailable
  48. 505 HTTP Version Not Supported
  49. 520 Unknown Error