【发布时间】:2019-03-22 21:44:47
【问题描述】:
我创建了这个 .htaccess 规则来显示前端和后端部分:
Options +FollowSymLinks
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
RewriteRule ^backend(/.*)?$ /backend/web/$1 [L]
# handle the case of frontend
RewriteRule .* /frontend/web/$0
# Uncomment the following, if you want speaking URL
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^([^/]+/web)/.*$ $1/index.php
backend 部分的规则(第二条规则)按照我需要的 url 像这样https://example.com/backend/web/site/login 但不加载后端登录页面,只显示前端主页。当用户使用后端作为https://example.com/backend 时,我想显示后端登录页面。但是,这不起作用。
当我更改如下规则时,规则会根据需要显示后端登录页面。但我只想在用户在 url 中输入后端时显示后端登录页面:
RewriteRule ^.*$ /backend/web/$1 [L]
这适用于本地端,但不适用于我的 1&1 IONOS 专用服务器端。
请帮我根据需要加载我的后端登录页面。
谢谢
【问题讨论】:
标签: regex apache .htaccess mod-rewrite url-rewriting