[英]Remove folder name from URL using .htaccess, but not admin
Wanted to remove directory name /front/
from the URL using .htaccess
but not /admin/
. 想要使用
.htaccess
从URL中删除目录名称/front/
,而不要使用/admin/
。 Below code is working fine and also redirects /admin/
to /pages/admin/
下面的代码工作正常,也可以将
/admin/
重定向到/pages/admin/
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !(.*)front|shared
RewriteRule ^(.*)$ front/$1 [L]
Please suggest to avoid /admin/
redirection. 请建议避免
/admin/
重定向。
Thanks 谢谢
You can try with this code: 您可以尝试使用以下代码:
RewriteEngine On
RewriteBase /
RewriteRule ^front/(.*)$ /$1 [L,NC,R]
Have it this way: 有这种方式:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(front|shared) [NC]
RewriteRule ^(.*)$ front/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.