使用htaccess重写php扩展和查询字符串

时间:2017-10-25 21:23:52

标签: php .htaccess

我需要使用htaccess为网站重写一些网址,并且正在努力让它发挥作用。这些是我需要做的事情:

删除附加信息

http://domain.co.uk/services.php            >   http://domain.co.uk/services
http://domain.co.uk/about-us.php            >   http://domain.co.uk/about-us
http://domain.co.uk/knowledge-base.php      >   http://domain.co.uk/knowledge-base
http://domain.co.uk/quotation-tool.php      >   http://domain.co.uk/quotation-tool

删除查询字符串

http://domain.co.uk/services.php?service=something     > http://domain.co.uk/services/something

http://domain.co.uk/services.php?cat=foo&s=bar         > http://domain.co.uk/services/foo/bar

http://domain.co.uk/knowledge-base.php?cat=something   > http://domain.co.uk/knowledge-base/something

http://domain.co.uk/knowledge-base.php?cat=foo&s=bar   > http://domain.co.uk/knowledge-base/foo/bar

我需要它才能工作,因此输入更新版本的人可以获得正确的页面。任何帮助非常感谢

0 个答案:

没有答案