【发布时间】:2014-02-01 09:56:57
【问题描述】:
来自以下网址:
localhost/videos/the-best-games
还有一个名为“categories”的目录,其中包含与 .htaccess 相同的目录中的各种文件:
./games.txt
./sports.txt
./football.txt
如何使用 url slug "the-best-games" 来检查 "categories" 中的这些文件名
./categories/the.txt
./categories/best.txt
./categories/games.txt
并使用第一个匹配的文件名重写 url:
localhost/games/videos/the-best-games
或
localhost/games/videos/the-best
可能基于这些先前的问题:
【问题讨论】:
-
URL 可以是无限长的,例如:
http://localhost/videos/the-best-games-on-earth,并且您还想检查on.php和earth.php吗? -
这很好,但我们可以慢慢开始。
标签: apache .htaccess mod-rewrite slug backreference