需要路由到不同的php文件,并使用.htaccess调用单独的函数


Need to route to different php files and call separate functions using .htaccess

需要将api调用路由到两个不同的PHP文件,并在这些PHP文件中调用不同的函数。

网址:1)http://localhost/dual/LOGIN

这应该调用login.php在其中应该调用log_in()函数

http://localhost/dual/REGISTER

2)

这应该调用register.php函数里面应该调用register_in()

如何编写。htaccess文件来允许这样的url重写RewriteEngine

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^LOGIN/$ login.php?request=$1 [QSA,NC,L]
RewriteRule ^REGISTER$ register.php?request=$1[QSA,NC,L]

不知道关于这个。htaccess文件,需要一些帮助。提前感谢

如果dual是一个真正的目录,并且。htaccess存在于双文件夹中,那么这个简单的。htaccess应该可以工作:

RewriteEngine On
RewriteBase /dual/
RewriteRule ^(login|register)/?$ $1.php [L,NC]