2014-11-06 74 views
0

我试图重写动态重写URL我想改变URL动态重写规则

www.mysite.com/page.php?title=About Us 
with this 
www.mysite.com/about-us 

我所做的是手动这样

RewriteRule ^about-us$ page.php?title=About\ Us [NC,L] 

但我想它应该是动态的新未来我不想手动添加新的页面链接到的htaccess

我试图

RewriteRule ^(.+)$ flights-detail1.php?dest=$1 

但它不适合我。需要专家的意见,请

+0

有什么不对的,你有什么? – hjpotter92 2014-11-06 17:58:44

回答

0

重定向您所有的网页:

www.mysite.com/about-us 
www.mysite.com/other 
www.mysite.com/etc 

这样

www.mysite.com/page.php?title=about-us 
在你的.htaccess

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^page\.php 
RewriteRule ^(.+)$ page.php?title=$1 [L,QSA] 
+0

没有它没有为我工作 – user3837462 2014-11-06 18:45:50

+0

我只是在这里测试一台服务器,这工作得很好...看看你的FTP软件已发送.htaccess文件在文本模式(不是二进制) – Croises 2014-11-06 20:49:53

+0

它显示空白页面没有任何数据。就像我浏览page.php而不是page.php?title = about-us – user3837462 2014-11-10 12:53:48