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. :-)
Best answer: 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
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:
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
<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
Response by poster: 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
posted by tcv at 7:28 PM on December 4, 2007
This thread is closed to new comments.
posted by bonaldi at 5:32 PM on December 4, 2007