htaccess用另一个屏蔽我的url路径


htaccess to mask my url path with another one?

我想使用url domain.com/login,但在后台(隐藏)应该是domain.com/account/index.php

有什么可行的方法吗?

我当前的htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^'.]+)$ $1.php [NC,L]

将文件更新为..

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^login$ account/index.php [NC]
RewriteRule ^([^'.]+)$ $1.php [NC,L]

^是路径的开始,$是路径的结束。如果你需要/想要它更宽松,你可以取下它们中的任何一个。

例如

RewriteRule ^login

适用于/login/logins

RewriteRule ^logins?$

也会起作用,

RewriteRule ^logins$

将仅匹配CCD_ 5。