Rails - How to Redirect from http://example.com to https://www.example.com

前端 未结 6 669
感动是毒
感动是毒 2020-12-23 16:56

I\'m looking to learn how to cleanup my app\'s URLs. My app is powered by Rails 3 on Heroku.

The desired URL is https://www.example.comite.com

I

6条回答
  •  醉梦人生
    2020-12-23 17:19

    DO it in your vhosts file.

    Setup a SSL vhost.

    In your standard port 80 virtual host. Add this to the config:

    Redirect permanent / https://www.mysite.com
    

    This will forward all port 80 requests to https.

提交回复
热议问题