Want the 411 on 301!
December 4, 2007 5:27 PM   RSS feed for this thread Subscribe

I recently purchased an SSL certificate for my website and have configured an application to operate over SSL. It's working well. One thing remains: I want to make sure that if someone tries to access the application over HTTP, the browser page is redirected to the SSL (HTTPS) version. I am fairly certain the pages the application creates are PHP, but I am unsure. (They're not static, I don't think. They're all dynamically created through mySQL.) The entry point for the application is a subdirectory off the domain /kb/. I'll add more answers if you folks need it. :-)
posted by tcv to technology (5 comments total) 2 users marked this as a favorite
Is this Apache? Because .htaccess will do this in a blink for you.
posted by bonaldi at 5:32 PM on December 4, 2007


There are a number of ways to do with with Apache, you can do it with .htaccess or the actual servers config itself.

Some references:
http://www.whoopis.com/howtos/apache-rewrite.html

http://joseph.randomnetworks.com/archives/2004/07/22/redirect-to-ssl-using-apaches-htaccess/
posted by iamabot at 5:39 PM on December 4, 2007


Using mod_rewrite in Apache:

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_METHOD} ^TRACE
   RewriteRule .* - [F]
   RewriteRule ^/kb(.*)$ "https://www.myhostname.com/kb$1"
</IfModule>


If the user visits http://www.myhostname.com/kb/1234, they will be redirected to https://www.myhostname.com/kb/1234
posted by Blazecock Pileon at 6:30 PM on December 4, 2007


This is Apache.
posted by tcv at 7:12 PM on December 4, 2007


WOOHOO! It works. I used the second example from randomnetworks.com!! YAYAYAYAY! WAHOO, etc.
posted by tcv at 7:28 PM on December 4, 2007


« Older How can I give my shoes tracti...   |   Someone bought a telescope in ... Newer »
This thread is closed to new comments.


Related Questions
Two Blogs, One Site July 29, 2008
Making Complex Connection Webs December 13, 2007
Easy way to sell documents on the web? June 23, 2007
Help me help my girlfriend create a website. November 10, 2006
Advice in designing a web application for a... July 11, 2006