0

I bought a ready-made Laravel script that was developed to run on Apache server, and the developer doesn't support to Nginx rewrite rules. Can someone help me? When I try to access the system on my Nginx server it gives multiple redirects error. I've tried it in several ways and I can't, I even used online converters, but it doesn't work.

This is the original .htaccess from the script:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On
    <IfModule mod_ssl.c>
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    </IfModule>

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

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    RewriteCond %{THE_REQUEST} /index\.php/(.+)\sHTTP [NC]
    RewriteRule ^ /%1 [NE,L,R]
    
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^ index.php [L]
    
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteRule ^ index.php [L]
    
</IfModule>
user3416348
  • 11
  • 1
  • 3
  • _Aside:_ That last rule is a bit unusual... it would result in requests for any physical resources, that do not contain `/public/` at the start of the URL-path also being routed to the Laravel front-controller. Ordinarily, `/public/` shouldn't be in the public URL-path to begin with, so this potentially means that every request is sent through the front-controller. Is that the intention? Is this like a members-only site where _every_ request must be authenticated or something? – MrWhite Dec 30 '21 at 16:43
  • yes, the script is a backend for an android app – user3416348 Dec 30 '21 at 16:50
  • why not install apache and use the native way? apache can run on a different port? – djdomi Dec 30 '21 at 21:02

0 Answers0