Answer the question
In order to leave comments, you need to log in
How do I make the url backend a separate link?
I have a question, how should I write apache so that there are 2 links /
for the frontend and /backend
for the backend
Here I tried to do something like this
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/.*
RewriteRule ^(.*)$ frontend/web/$1 [L]
RewriteCond %{REQUEST_URI} ^/backend
RewriteRule ^(.*)$ backend/web/$1 [L]
RewriteCond %{REQUEST_URI} !^frontend/web/
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ frontend/web/index.php
</IfModule>
Answer the question
In order to leave comments, you need to log in
Good afternoon.
To do this, you need to use two .htaccess, one in the root of the project, the second in the web.
In the web directory (frontend and backend), this .htaccess is enough
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
RewriteEngine On
# End the processing, if a rewrite already occurred
#RewriteRule ^(frontend|backend)/web/ - [L]
# Handle the case of backend, skip ([S=1]) the following rule, if current matched
RewriteCond %{REQUEST_URI} ^/(name_folder/backend)
RewriteRule ^backend(/.*)?$ backend/web/$1 [L]
# handle the case of frontend
RewriteCond %{REQUEST_URI} ^/(name_folder)
RewriteRule ^(.*)$ frontend/web/$1 [L]
name_folder
- directory name, if the project is located in the subdirectory of the site. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question