我陷入了这个 .htaccess 问题,无法找到解决方案。什么都试过了,但由于我是 htaccess 的新手,可能是代码不匹配,这给了我一个错误。
我正在处理一个 php 文件..
这是我现在得到的结果
http://website.com/page.php?url=diploma-in-film-acting
现在我希望它像这样工作
http://website.com/diploma-in-film-acting
或者可能是这个
http://website.com/diploma-in-film-acting.html
我如何让它工作???
这段代码我已经用过了
我已经这样做了,但是当我将其添加到 url http://website.com/diploma-in-film-acting.html 时出现 404 错误
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ page.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ page.php?url=$1
谢谢
最佳答案
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /page.php?url=$1 [L]
关于php - .htaccess 重定向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14907934/