0

I'm trying to do this in .htacess file in public folder on laravel which i can not get anything work, I want to keep rediect from www to non www but keep the url as well. This is my htacess file at the moment.

  RewriteEngine On

    # If we receive a forwarded http request from a proxy...
    RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]

    # ...or just a plain old http request directly from the client
    RewriteCond %{HTTP:X-Forwarded-Proto} =""
    RewriteCond %{HTTPS} !=on

    # Redirect to https version
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
John
  • 1
  • 3
    Possible duplicate of [Generic htaccess redirect www to non-www](https://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www) – SaidbakR Dec 17 '17 at 10:24
  • Hey, that does not seem to work for me with laravel for some reason. – John Dec 17 '17 at 11:03
  • It works, but try to clear browser's cache! – SaidbakR Dec 17 '17 at 11:06
  • That was the problem, but it seems to show index.php/ also .php was hidden on all pages in laravel before, is there a way to hide this again? – John Dec 17 '17 at 11:14

0 Answers0