0

Hi we have developed a web app in laravel. Now we have two sub domains:

Devpanel.example.com Panel.example.com

We want to make sure that we redirect www and http traffic to https and non www. Example:

Http:// panel. example. com to https:// panel. example. com

Http:// www. panel. example .com to https:// panel. example .com

Also any subpages shall be moved as an example http:// panel. example. com/users shall go to https:// panel. example. com/users and http:// www. panel .example .com/users shall go to https:// panel. example .com/users

If we are logged in to the app of course it should redirect us to the logged in state for all above scenarios.

Since this app is done in laravel it appends index.php in the URL when http is redirected to https. How can we make sure to remove this?

Any help on the above would be amazing.

cre8
  • 13,012
  • 8
  • 37
  • 61
Amko
  • 1
  • the `www.` and `http to https` checks belong into the htaccess file, not laravel – cre8 Sep 12 '17 at 13:20
  • Yes, either in httpd.config or htaccess. But can't get it working. – Amko Sep 12 '17 at 14:15
  • Possible duplicate of [.htaccess redirect www to non-www with SSL/HTTPS](https://stackoverflow.com/questions/1478173/htaccess-redirect-www-to-non-www-with-ssl-https) – Don't Panic Sep 12 '17 at 15:18

1 Answers1

0

You can edit the web.php file

if (env('APP_ENV') === 'production') {
URL::forceSchema('https');}

add the code above at the top To force on all pages.

Abid Rakhmansyah
  • 896
  • 8
  • 22