1

I want to edit my .htaccess file so all the requests will be encrypted (I have SSL certificate active). I'm trying to run a Laravel app, which has Index file in public folder and I want to let user access my page without the /public/ part in URL.

So far, I managed to do this:

This part let me access the page without the /public/ part.

RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]

This part redirects all data to HTTPS:

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://domain.club/public_html/1 [R,L]

The question is, how do I merge these two together? They work separately, but not if I put this together in .htaccess file.

.htaccess file is located in public_html which is located in root folder. Laravel folders (incluing public) are located in this folder.

Rok Dolinar
  • 976
  • 3
  • 13
  • 29

1 Answers1

0

Try this

.htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
Tiffany Soun
  • 523
  • 3
  • 9
  • 18