.htaccess - 配置文件系统的重写规则

标签 .htaccess mod-rewrite url-rewriting friendly-url

我想将website.com/member/gami重定向到website.com/member.php?name=gami

我已经尝试过:

RewriteRule ^(.*)/member$ member.php?name=$1 [NC, QSA]

最佳答案

根据您显示的规则,请尝试遵循 htaccess 规则。请确保在测试您的网址之前清除浏览器缓存。

RewriteEngine ON
##Internal rewrite rules for non-existing uris to php files internally.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^/]*)/(.*)/?$ $1.php?name=$2 [QSA,L]

关于.htaccess - 配置文件系统的重写规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68391906/

相关文章:

apache - .htaccess:如何通过 IP 限制对单个文件的访问?

zend-framework - 如何使用 .htaccess 强制 www.在使用 Zend 框架时

.htaccess 规则在没有任何响应的情况下断开连接

apache - 如果不存在图像则显示默认图像

c# - 重写规则以重定向 URL

.htaccess 规则将图像文件的直接 View 重定向到页面,图像作为查询字符串传递

.htaccess - 使用 rewrite_mod 将 index.php 重定向到 root,将 www 重定向到非 www

php - .htaccess 重定向到仅用于主页的子域 (OpenCart)

apache - Slim(PHP)RESTful API的Apache重写规则

ASP.NET Core URL 重写