HTACCESS:将所有请求重定向到另一个页面,代替索引,隐藏参数?

HTACCESS: Redirect all the requests to another page, in place of index, hiding arguments?

我在这里暴露我的问题,我希望能清楚和正确地解释我自己。有什么规格可以问我

我需要的是将所有请求(到 index.php 的请求除外)重定向到另一个 .php 文件,而无需指定参数。

这是我需要做的一个例子:

http://www.example.com -> shows index.php

但是:

http://www.example.com/songs/title-of-the-song

应该调用页面: songs.php?dir=title-of-the-song 当然不向用户显示字符串 "songs.php?dir=title-of-the-song" 而只是 URL

http://www.example.com/songs/title-of-the-song

这是 Drupal 的情况,但我没有在我的网站上使用该 CMS。

您可能正在寻找类似的东西:

RewriteEngine on
RewriteRule ^/songs/(.+)$ /songs.php?dir= [L]

注意:这是http主机配置的版本。要在 .htaccess 样式文件中使用,您必须稍微调整一下。但是如果你有权访问主机配置,你应该总是喜欢 .htaccess 样式文件。这些文件需要一个额外的模块,出了名的容易出错,难以排除故障并且确实会降低服务器速度。