Want the 411 on 301!
December 4, 2007 5:27 PM   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 answers 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:

posted by iamabot at 5:39 PM on December 4, 2007

Using mod_rewrite in Apache:

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

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 better traction?   |   I bought what??? Newer »
This thread is closed to new comments.