如何将此动态网址转换为静态网址

时间:2014-07-24 03:35:25

标签: php .htaccess

我的链接就是这个

http://mr-saggu.net/Dwnld.php?id=dwl&singletrack=Jhanjhar&by=Kaka%20Bhainiawala%20Ft%20Nixon%20Minna

我想将其更改为

http://mr-saggu.net/singletrack-Jhanjhar-by-Kaka-Bhainiwal-Ft-Nixon-Minna.html

我在我的.htaccess文件中写了这个

Options +FollowSymLinks
RewriteBase /
RewriteRule  ^Dwnld-id-(.*)-singletrack-(.*)-by-(.*)\.html$ Dwnld.php?id=$1&singletrack=$2&by=$3

我想在所有歌曲上自动转换动态网址

1 个答案:

答案 0 :(得分:0)

试试这个:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule  ^singletrack-([^-]+)-by-([^.]+)\.html /Dwnld.php?id=dwl&singletrack=1$&by=$2 [L]

然后使用您提供的网址尝试

http://mr-saggu.net/singletrack-Jhanjhar-by-Kaka-Bhainiwal-Ft-Nixon-Minna.html