首页 > 解决方案 > .htaccess 在匹配包含 URL 中的单词时调用特定页面

问题描述

我怀疑如何创建包含特定单词的页面 url 的 .htaccess 以使用 index.php 中的性能。

我的意思不是将 301 重定向到 index.php。

但我想访问诸如 /my-account/lost-password/index.html 或 /my-account/create/index.html 之类的 url。当访问这两个 url 时,它会被称为 index.php 中的内容,而不会重定向到 index.php。

是否可以编写 .htaccess 来满足上述要求?

谢谢

标签: php.htaccess

解决方案


你的意思是这样的?

RewriteEngine On
RewriteCond %{REQUEST_URI} /lost-password/index.html
RewriteRule . index.php [L]

假设您将其放在文件my-account夹中的 htaccess 文件中。


推荐阅读