删除profile.php?name= url中的用户名并替换为profile/用户名



我的php文件有问题。我想创建一个网站,url是这样的

domain.com/players/username

我有我的文件夹设置如下:domain.com/players/players.php ?用户名= johndoe

在主文件夹(domain.com/players/index.php)我有一个搜索表单,张贴到播放器。php文件,这样我想使它能够搜索他的用户名球员

So ->删除/players.php?Username =johndoe,修改为/players/johndoe用户可以在domain.com/players/johndoe查看他们的个人资料

谢谢大家的帮助,如果这是一个不好的问题,我很抱歉

像这样的东西应该会有效果,

<IfModule mod_rewrite.c>
# Turn on the engine:
RewriteEngine on
# Set the base to this directory:
RewriteBase /username/
# Redirect certain paths to player.php:
RewriteRule ^(username)/?$ players.php?username=$1
</IfModule>

这是一个htaccess文件,因此您还必须确保在服务器的httpd.conf文件中启用了mod_rewrite。

相关内容

最新更新