.htaccess规则支持三种不同类型的URL方案

时间:2017-08-06 10:11:14

标签: php apache .htaccess mod-rewrite

我的网站有三种不同类型的网址方案:

  1. http://example.com/page.php
  2. http://example.com/anotherpage.php/23其中23是ID,并被捕获为GET数据。
  3. http://example.com/yetanotherpage.php/23/somedata其中23somedata被捕获为GET数据。
  4. 我需要的.htaccess规则是example.com/被视为PHP页面之后的所有内容,例如:

    1. http://example.com/page.php转换为http://example.com/page
    2. http://example.com/anotherpage.php/23转换为http://example.com/anotherpage/23
    3. http://example.com/yetanotherpage.php/23/somedata转换为http://example.com/yetanotherpage/23/somedata
    4. 我能够为#1编写规则,但没有找到#2和#3的任何内容。

0 个答案:

没有答案