【发布时间】:2017-04-12 05:21:13
【问题描述】:
对于域 www.example.com,我想将用户定向到 index.php。使用
DirectoryIndex index.php
我这样做。但是,如果它们包含斜杠和非文件类型的值,我想将它们重定向到不同的页面并将该值用作 php get 变量:
www.example.com/hello lands on a_different_page.php?var=hello
但我不想打扰以“php”结尾的请求,例如:
www.example.com/page.php
不应尝试重定向。而且对纯 url 的请求也不应该改变:
www.example.com goes to index.php
我已经找到了一些方法来实现其中的一些,但它们总是会干扰其他请求,这是一个意想不到的结果。任何帮助将不胜感激 - 我对 htaccess 重写的研究没有帮助。
【问题讨论】:
标签: php apache .htaccess redirect mod-rewrite