【发布时间】:2017-04-22 09:23:52
【问题描述】:
1) 如果文件扩展名是 PHP 或 (S)HTM(L),我想创建一个重写规则,删除 URL 末尾的文件。例如:
This: http://www.example.com/index.php
Becomes: http://www.example.com/
This: http://www.example.com/index.php?action=login
Becomes: http://www.example.com/?action=login
2) 我想用我的 .htaccess 设置一些 URL 重定向,这样如果有人浏览某个路径,就会自动重定向到 /index.php。例如:
This: http://www.example.com/classes/(index.php)
Redirected To: http://www.example.com/(index.php)
This: http://www.example.com/classes/class.php
Redirected To: http://www.example.com/(index.php)
This: http://www.example.com/classes/style.css
Redirected To: http://www.example.com/(index.php)
有什么线索吗? 非常感谢!
【问题讨论】:
标签: apache .htaccess mod-rewrite redirect