Closed diogenesjup closed 3 years ago
Have you configured your web server so the public folder is the root folder? When you say the router stopped working, what exactly happened? Did you get any error messages?
Yes! I could do that. But the environment I'm using, there are other applications running on the same server. Then I tried to remove the public from the URL to be able to run it independently.
Example
www.domain.com.br/mvc/public (it works here)
then I edited (or tried to edit) to stay
www.domain.com.br/mvc/
part of it is because it could run different applications in the same environment.
www.domain.com.br/mvc1/ www.domain.com.br/mvc2/ www.domain.com.br/mvc3/
etc etc.
I tried both to move index.php and htaccess to the root of the directory, as well as trying to create an index that points to the public folder, but both to no avail.
You can have the framework in a subfolder by having two .htaccess files, one in the root of the subfolder:
RewriteEngine On
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) public/$1 [L]
and another in the public folder:
RewriteEngine On
RewriteBase /mvc
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
Note the RewriteBase
directive with the name of the folder.
Alternatively, if you have several projects on the same server, you can set up a virtual host for each one so each one has its own web root. Instructions on how to do that here.
Tks!! It`s work with your instructions!
I try to remove the "public" from the URL. After copy index.php and .htaccess to root, the router stop working. I try change the index.php destination, but same error
RewriteRule ^(.*)$ public/index.php?$1 [L,QSA]