我想将http://example.com/index.php?a=music重定向到http://example.com/music(其中数字是变量/动态)。我的网站是http://示例。 COM
我将以下行添加到我的.htaccess文件中的mod-rewrite规则中:
// models/Parking
module.exports = {
attributes: {
name: { type: 'string'},
reservations: {
collection: "reservation",
via: "parking",
},
getReservationsCount: function(cb) {
return Parking.findOne(this.id).populate('reservations').exec(function(err, result){
cb(result.reservations.length);
});
},
}
};
然而,它似乎不起作用。我知道我做错了什么,我只是不确定如何解决它。任何帮助表示赞赏。
最佳, 杰夫
编辑: 谢谢汤姆,
这就是我所拥有的:
RewriteRule ^index\.php$/?/a/=(.*)$ http://example.com/index.php?a=$1 [L,R=301]
答案 0 :(得分:0)
这应该有效:
RewriteRule ^(.*)$ /index.php?a=$1 [L]