[英]Apache2 multiple folders
I have following structure of my project 我的项目结构如下
root
ra-cms-admin
dist
ra-cms-admin
index.html
...
ra-cms-public-and-api
public
index.php
...
ra-cms-admin is the single page application. ra-cms-admin是单页应用程序。 I need when a user goes to / I want to redirect to ra-cms-public-and-api->public->index.php , and when the user goes to /admin (or /admin/something...) I want to redirect to single ra-cms-admin->dist->ra-cms-admin->index.html else I want to redirect always to to ra-cms-public-and-api->public->index.php (/something...). 我需要在用户转到/我想重定向到ra-cms-public-and-api-> public-> index.php时 ,以及在用户转到/ admin(或/ admin / something ...)时想重定向到单个ra-cms-admin-> dist-> ra-cms-admin-> index.html,否则我想始终重定向到ra-cms-public-and-api-> public-> index.php (/东西...)。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^admin ra-cms-admin/dist/index.html [L]
RewriteRule ^ ra-cms-public-and-api/public/index.php [L]
</IfModule>
This app project is on my server in test folder.So when you want to access this app, you need to go localhost/test , but I have problem with admin section, when i put localhost/admin I am redirected still to public section... Any idea? 这个应用程序项目在我的服务器上的test文件夹中。因此,当您要访问此应用程序时,需要进入localhost / test,但是我在admin部分遇到了问题,当我将localhost / admin放置时,我仍被重定向到public部分。 .. 任何想法? According to https://htaccess.madewithlove.be/ my solutions should work, admin is matched... 根据https://htaccess.madewithlove.be/我的解决方案应该可以工作,管理员是匹配的...
你能试一下吗?
RewriteRule ^admin ra-cms-admin/dist/ra-cms-admin/index.html [R=301,L]
Move UP, or use RewriteCond. 向上移动,或使用RewriteCond。
RewriteEngine On
RewriteRule ^admin/(.+)$ /ra-cms-admin/dist/%1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.