Secure Certificates and missing www

April 27, 2009 – 10:00 pm

Thanks to forgiving server-configurations it usually doesn’t matter whether you access a website via the fully qualified URL including “www” or without it - requests to http://codemassacre.com and www.codemassacre.com are taking you to the same place. After all you want to make it as easy as possible for people to access your website, so being forgiving is important.

However, as soon as you try to secure your site with help of a secure certificate and the corresponding https protocol, you need to pay closer attention, and, ultimately, make a choice as to which domain name the certificate applies to, because it will be either with www, or without.

Specifically, requesting https://some-domain.com for a site that only has a certificate for https://www.some-domain.com will cause your browser to raise a warning about an invalid certificate and block the site - certainly not a trust-invoking impression to give a potential customer! (unfortunately I am speaking first hand here, hehehe ;)

So, long story short, here’s an .htaccess entry that forces all requests to your site to have a www at the beginning:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^some-domain.com
RewriteRule (.*) http://www.some-domain.com/$1 [R=301,L]

What’s happening here is that  we’re watching the HTTP_HOST server variable for anything that starts with “some-domain.com”. The ^ signifies the beginning of a string. If this condition is fulfilled, we rewrite any request (.*) to the fully qualified url, and we append whatever was matched by the (.*) part - which goes into the $1 variable. Lastly, we set the R=301 flag to tell the client browsers that this redirect is permanent. The L is for good taste to make sure this is the last rule applied to this request (no point in applying any other rules..).

Now requests to https://some-domain.com will be redirected to https://www.some-domain.com, the certificate matches, and the browser is happy - and so is whoever visited your site, because as we all know “ignorance is bliss” ;)


Filed under: Rnadom Sftuf — Tags: , , — by Richtermeister

81 Comments »

  1. Добрый вечер! mason@sportbul.ru” rel=”nofollow”>……

    С уважением,…

    Trackback by Konstantin — June 19, 2010 @ 9:27 am


  2. MedicamentSpot.com. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. No prescription pills. Order drugs online

    Buy:Cialis Professional.Super Active ED Pack.Cialis Soft Tabs.Cialis.Maxaman.Viagra Soft Tabs.Viagra Super Force.Viagra Super Active+.Cialis Super Active+.Levitra.Tramadol.VPXL.Soma.Viagra Professional.Zithromax.Propecia.Viagra….

    Trackback by MELVIN — July 21, 2010 @ 4:58 am


  3. CheapTabletsOnline.Com. Canadian Health&Care.No prescription online pharmacy.Best quality drugs.Special Internet Prices. High quality drugs. Order pills online

    Buy:Petcam (Metacam) Oral Suspension.Nexium.Human Growth Hormone.Lumigan.Arimidex.Zovirax.100% Pure Okinawan Coral Calcium.Accutane.Synthroid.Prednisolone.Actos.Valtrex.Mega Hoodia.Retin-A.Prevacid.Zyban….

    Trackback by WENDELL — September 7, 2010 @ 4:09 pm


  4. NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

    Trackback by JOSEPH — November 10, 2010 @ 11:19 pm

  5. Abilify@official.site” rel=”nofollow”>.

    Buywithout prescription…

    Trackback by ARTURO — December 20, 2010 @ 1:55 am

  6. symbicort vs advair

    Buyno prescription…

    Trackback by GUY — December 22, 2010 @ 4:07 am

  7. Risperdal@official.site” rel=”nofollow”>..

    Buynow it…

    Trackback by ANDREW — January 7, 2011 @ 9:01 am

  8. Verapamil

    Buygeneric drugs…

    Trackback by CHRIS — February 3, 2011 @ 12:10 pm

  9. alternative for warfarin medication

    Buynow…

    Trackback by KYLE — February 6, 2011 @ 1:43 am

  10. zoloft works

    Buygeneric pills…

    Trackback by PAUL — March 3, 2011 @ 6:00 pm

  11. Vitamin E

    Buygeneric drugs…

    Trackback by CLINTON — March 3, 2011 @ 10:42 pm

  12. claritin eye drops

    Buygeneric drugs…

    Trackback by MIGUEL — March 6, 2011 @ 6:16 am

  13. singulair hyper

    Buygeneric drugs…

    Trackback by GILBERT — March 7, 2011 @ 11:39 pm

  14. Prozac

    Buygeneric meds…

    Trackback by CHESTER — March 9, 2011 @ 12:43 am

  15. buy orlistat alli

    Buygeneric drugs…

    Trackback by PETER — March 9, 2011 @ 2:48 pm

  16. Skelaxin@Skelaxin.Skelaxin” rel=”nofollow”>..

    Buyit now…

    Trackback by CARL — March 29, 2011 @ 5:38 pm

  17. Cytoxan@Cytoxan.Cytoxan” rel=”nofollow”>..

    Buydrugs without prescription…

    Trackback by JAIME — March 30, 2011 @ 4:37 pm

  18. Provera@Provera.Provera” rel=”nofollow”>…

    Buydrugs without prescription…

    Trackback by ALLEN — March 31, 2011 @ 3:47 am

  19. Seroquel@Seroquel.Seroquel” rel=”nofollow”>…

    Buydrugs without prescription…

    Trackback by ALBERT — March 31, 2011 @ 3:08 pm

  20. Buygeneric drugs…

    Trackback by DAN — April 2, 2011 @ 11:05 am

  21. celexa@and.mda” rel=”nofollow”>…

    Buygeneric drugs…

    Trackback by JACOB — April 2, 2011 @ 7:00 pm

  22. claritin@helps.poison.ivy” rel=”nofollow”>…

    Buydrugs without prescription…

    Trackback by TERRY — April 3, 2011 @ 1:20 am

  23. difference@between.medrol.and.prednisolone” rel=”nofollow”>…

    Buywithout prescription…

    Trackback by IVAN — April 3, 2011 @ 6:16 pm

  24. prozac@and.diflucan.drug.interactions” rel=”nofollow”>…

    Buygeneric drugs…

    Trackback by DAN — April 4, 2011 @ 5:28 am

  25. aloe@vera.gel.benefits” rel=”nofollow”>.

    Buyit now…

    Trackback by THOMAS — April 4, 2011 @ 12:26 pm

  26. arava@institute.for.enviornmental.studies.dr.elaine.solowey” rel=”nofollow”>..

    Buynow…

    Trackback by RICK — April 5, 2011 @ 5:45 am

  27. best@ay.to.take.extenze” rel=”nofollow”>…

    Buyit now…

    Trackback by ROLAND — April 5, 2011 @ 8:15 am

  28. femara@and.hives” rel=”nofollow”>..

    Buyno prescription…

    Trackback by FRANCISCO — April 5, 2011 @ 5:18 pm

  29. livingston@foot.care.bellmore” rel=”nofollow”>.

    Buyit now…

    Trackback by KURT — April 6, 2011 @ 11:16 am

  30. Buy@Cheap.Abana” rel=”nofollow”>..

    Buygeneric pills…

    Trackback by EDUARDO — July 29, 2011 @ 2:56 am

  31. Purchase@Abilify.Online” rel=”nofollow”>…

    Buywithout prescription…

    Trackback by PERRY — July 29, 2011 @ 11:49 am

  32. Buy@Generic.Abilify.5mg.10mg.15mg.20mg.30mg” rel=”nofollow”>…

    Buywithout prescription…

    Trackback by ROY — July 29, 2011 @ 6:40 pm

  33. Purchase@Discount.Acai” rel=”nofollow”>..

    Buywithout prescription…

    Trackback by RUSSELL — July 30, 2011 @ 2:35 pm

  34. Buy@Acai.Without.Prescription” rel=”nofollow”>…

    Buynow…

    Trackback by SALVADOR — July 30, 2011 @ 8:35 pm

  35. Buy@Cheap.Coral.Calcium” rel=”nofollow”>.

    Buynow it…

    Trackback by EDUARDO — July 31, 2011 @ 11:51 am

  36. Buy@Cheap.Coral.Calcium” rel=”nofollow”>…

    Buygeneric meds…

    Trackback by RONALD — July 31, 2011 @ 10:17 pm

  37. Cheap@Coral.Calcium.Online” rel=”nofollow”>..

    Buygeneric drugs…

    Trackback by DUSTIN — August 1, 2011 @ 1:18 am

  38. Order@Discount.Abana” rel=”nofollow”>..

    Buygeneric meds…

    Trackback by SALVADOR — August 1, 2011 @ 4:09 am

  39. Buy@Abilify.Online” rel=”nofollow”>..

    Buynow it…

    Trackback by LEWIS — August 1, 2011 @ 6:41 am

  40. Buy@Cheap.Abilify” rel=”nofollow”>…

    Buygeneric pills…

    Trackback by LESLIE — August 2, 2011 @ 8:23 pm

  41. Cheap@Abilify.Without.Prescription” rel=”nofollow”>..

    Buyno prescription…

    Trackback by BRANDON — August 3, 2011 @ 5:21 am

  42. Order@Accupril.Online” rel=”nofollow”>.…

    Buygeneric drugs…

    Trackback by BOB — August 5, 2011 @ 1:11 pm

  43. Buy@Discount.Accutane” rel=”nofollow”>.…

    Buynow it…

    Trackback by BYRON — August 6, 2011 @ 12:33 am

  44. .

    Buygeneric drugs…

    Trackback by LOUIS — August 6, 2011 @ 12:05 pm

  45. Order@Cheap.Actos” rel=”nofollow”>.

    Buygeneric drugs zfk…

    Trackback by RAY — August 11, 2011 @ 3:31 am

  46. Get@Actos.Online” rel=”nofollow”>..

    Buywithout prescription dyo…

    Trackback by LAWRENCE — August 11, 2011 @ 7:21 am

  47. Actos@15mg.30mg.Without.Prescription” rel=”nofollow”>..

    Buygeneric meds qmo…

    Trackback by CLIFTON — August 12, 2011 @ 12:55 am

  48. Buy@Cheap.Accupril” rel=”nofollow”>.

    Buygeneric drugs nih…

    Trackback by BRYAN — August 15, 2011 @ 6:41 pm

  49. Cheap@Accutane.10mg.20mg” rel=”nofollow”>.

    Buyit now ojb…

    Trackback by VINCENT — August 17, 2011 @ 2:28 pm

  50. Order@Aciphex.Online” rel=”nofollow”>.

    Buynow it lmg…

    Trackback by MARVIN — August 18, 2011 @ 1:43 am

  51. Order@Discount.Aciphex” rel=”nofollow”>…

    Buygeneric meds svb…

    Trackback by JOHNNY — August 18, 2011 @ 4:07 am

  52. Cheap@Advair.Without.Prescription” rel=”nofollow”>…

    Buyit now sge…

    Trackback by BERNARD — August 23, 2011 @ 10:23 pm

  53. Buy@Cheap.Aggrenox” rel=”nofollow”>..

    Buygeneric meds dxy…

    Trackback by ALVIN — August 24, 2011 @ 3:08 pm

  54. Buy@Cheap.Aldactone” rel=”nofollow”>..

    Buydrugs without prescription hak…

    Trackback by RAUL — August 25, 2011 @ 8:26 pm

  55. can@you.take.aciphex.and.nexium.at.the.same.time” rel=”nofollow”>..

    Buygeneric pills…

    Trackback by BRAD — August 26, 2011 @ 8:11 am

  56. actonel@and.heart.irregularities” rel=”nofollow”>..

    Buyno prescription…

    Trackback by DARRYL — August 26, 2011 @ 8:07 pm

  57. aldactone@kidney.problems” rel=”nofollow”>…

    Buygeneric drugs…

    Trackback by MELVIN — August 27, 2011 @ 12:59 am

  58. actonel@and.dvt” rel=”nofollow”>.

    Buygeneric meds…

    Trackback by CLINTON — August 28, 2011 @ 10:27 am

  59. levaquin 500mg

    Buy_no prescription…

    Trackback by EVERETT — October 16, 2011 @ 9:57 pm

  60. financial aid for alzheimer’s

    Buy_without prescription…

    Trackback by ALBERT — October 20, 2011 @ 9:01 am

  61. heart worm medication

    Buy_no prescription…

    Trackback by TODD — October 20, 2011 @ 5:20 pm

  62. blood pressure medications

    Buy_now it…

    Trackback by ANTONIO — October 21, 2011 @ 10:12 pm

  63. hepatitis b shot

    Buy_it now…

    Trackback by BARRY — October 25, 2011 @ 5:52 pm

  64. drug trafficking in latin america

    Buy_drugs without prescription…

    Trackback by DAN — October 26, 2011 @ 2:16 am

  65. permanent removal of adult acne scars

    Buy_generic meds…

    Trackback by LAWRENCE — October 29, 2011 @ 2:46 am

  66. enhancement drugs

    Buy_no prescription…

    Trackback by KENNY — October 30, 2011 @ 6:15 am

  67. drug test company

    Buy_without prescription…

    Trackback by TERRENCE — October 30, 2011 @ 5:48 pm

  68. social etiologies for patients with schizophrenia

    Buy_it now…

    Trackback by JACOB — October 31, 2011 @ 10:30 am

  69. epson salt and lemon juice diet

    Buy_generic pills…

    Trackback by ERIC — November 2, 2011 @ 9:13 am

  70. l91 energizer e2 lithium aa cells

    Buy_generic drugs…

    Trackback by BRYAN — November 2, 2011 @ 2:09 pm

  71. how to buy glucose meter

    Buy_generic meds…

    Trackback by JOEY — November 3, 2011 @ 3:32 am

  72. skin cancer foundation australia

    Buy_generic drugs…

    Trackback by JEREMY — November 3, 2011 @ 9:17 am

  73. clinical features of sickle cell disease

    Buy_generic drugs…

    Trackback by CHRIS — November 4, 2011 @ 7:39 pm

  74. depression medcine xr

    Buy_drugs without prescription…

    Trackback by JEFFERY — November 6, 2011 @ 3:19 am

  75. school age adhd self absorbed

    Buy_now it…

    Trackback by CHARLIE — November 8, 2011 @ 9:31 am

  76. meal plan for hypertension

    Buy_generic drugs…

    Trackback by NATHAN — November 11, 2011 @ 3:51 pm

  77. scabies in dogs help

    Buy_generic drugs…

    Trackback by RAFAEL — November 12, 2011 @ 3:12 pm

  78. herbals for pregnancy

    Buy_drugs without prescription…

    Trackback by ALFRED — November 13, 2011 @ 2:53 am

  79. diet secrets for models

    Buy_now it…

    Trackback by WESLEY — November 16, 2011 @ 7:29 pm

  80. best@medicare.plan.d.for.nexium.40.mg” rel=”nofollow”>..

    Buygeneric meds…

    Trackback by JEREMY — December 11, 2011 @ 9:12 am

  81. infant@prevacid.dose” rel=”nofollow”>.

    Buygeneric drugs…

    Trackback by HARRY — December 11, 2011 @ 1:33 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress