How to rewrite URL in HTTPS?

URL Rewrite http to https with www

  • I have a domain with several apps. All apps should be reached like this. https://www.website.com/app1/ https://www.website.com/app2/ https://www.website.com/app3/ The problem I'm having is with my url rewrites. If someone enters website.com/app1/ or www.website.com/app1/ I want it to rewrite to this https://www.website.com/app1/ I've been attempting to use httpd.conf to solve this problem or just .htaccess in the document root folder without any luck. URL rewrite works fine in my codeignighter application, just not in these one off stand alone apps. Can anyone show me the proper way to incorporate url rewrites to solve the above problem?

  • Answer:

    Now open httpd.conf or .htaccess file (mod_rewrite not required): # vi httpd.conf Append following line : Redirect permanent /app1 https://www.website.com/app1 Any request made to http://www.website.com/app1 will goto https://www.website.com/app1 Save and close the file. Restart the Apache: # /etc/init.d/httpd restart

Vibration Of Life at Server Fault Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.