Php Nginx动态url重写位置
我想做那样的东西。因此,当我尝试登录时,系统会将我导航到Php Nginx动态url重写位置,php,.htaccess,nginx,url-rewriting,rewrite,Php,.htaccess,Nginx,Url Rewriting,Rewrite,我想做那样的东西。因此,当我尝试登录时,系统会将我导航到http://www.example.com/username我想重写到。/admin/index.php 我以前在.htaccess中做过,但在webserver中,nginx不起作用 location = /username { rewrite ^ /admin/index.php; } 指向此位置的我的php链接如下所示: <?php echo SITEURL . "/" . $user->
http://www.example.com/username
我想重写到。/admin/index.php
我以前在.htaccess中做过,但在webserver中,nginx不起作用
location = /username {
rewrite ^ /admin/index.php;
}
指向此位置的我的php链接如下所示:
<?php echo SITEURL . "/" . $user->username; ?>
当我手动更改/username
而不是我的真实用户名时,所有的工作方式都符合我的要求,但如何使用数据库中的变量username重写url?谢谢你的帮助