[英]htaccess rewrite rule accesing folder without redirect
I have an root folder like this: 我有一个像这样的根文件夹:
ROOT
|- Service
| |- Admin
|
|- Service 2
I'm interesting in accessing the admin
folder from service folder 我对从服务文件夹访问
admin
文件夹很感兴趣
To access the admin path via url i use mydomain.com/Service/Admin
要通过url访问管理路径,请使用
mydomain.com/Service/Admin
Is there any way to make it access like this mydomain.com/Admin
without moving folders? 有什么方法可以使它像
mydomain.com/Admin
这样访问而无需移动文件夹?
I got the answer from one guy and is working, but is not working if i don't add / at the end of Admin 我从一个人那里得到了答案,并且正在工作,但是如果我不添加/,请在Admin末尾不工作
RewriteEngine On
RewriteRule ^(Admin/.*)$ Service/$1 [L,NC]
mydomain.com/Admin/
- working mydomain.com/Admin/
工作
mydomain.com/Admin
- not working (404 error) mydomain.com/Admin
不起作用(404错误)
I want both to work 我都想工作
I made is like this and is working 我做的就是这样,正在工作
RewriteEngine On
RewriteRule ^Admin$ http://mydomain.com/Admin/ [L,NC]
RewriteRule ^(Admin/.*)$ Service/$1 [L,NC]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.