简体   繁体   中英

htaccess to mask my url path with another one?

I want to use the url domain.com/login but in the background (hidden) it should be the domain.com/account/index.php

Is there any possible way of doing this?

My current htaccess

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

Update your file to..

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

The ^ is the start of the path and the $ is the end of it. If you need/want it looser you can take off either of them.

For example

RewriteRule ^login

would work for /login and /logins

RewriteRule ^logins?$

would also work and

RewriteRule ^logins$

would only match /logins .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM