Hi, I have removed the public directory from laravel 5.3 and set my project to root directory. I renamed the server.php in the root directory to index.php and copied .htaccess file to the root directory. This works fine.
Now I tried to redirect http to https and non-www to www. Below is my .htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*) https://www.%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^.*\.env$ [NC,L]
RewriteRule ^.*\.json$ [NC,L]
RewriteRule ^.*\.xml$ [NC,L]
RewriteRule ^.*\.md$ [NC,L]
RewriteRule ^.*\.js$ [NC,L]
RewriteRule ^.*\.zip$ [NC,L]
</IfModule>
Now nothing is broken except the url. It shows as follows:
https://www.mywebsite.com/index.php/my_parameters
Can anyone help me with this?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community