【发布时间】:2015-05-18 15:14:45
【问题描述】:
我有这个以及它的作用,它会改变查询字符串,如下例所示:
<IfModule mod_rewrite.c>
#Options Allow All
DirectoryIndex index.php
RewriteEngine On
RewriteBase /folder/
RewriteRule ^page/([^/.]+)/?$ otherpage.php?id=$1 [L]
</IfModule>
所以如果我有这样的链接:
http://example.com/folder/otherpage.php?id=123
此 htaccess 将允许从以下位置访问该链接:
我想要更改查询字符串以查找我的任何(所有)页面(没有任何文件夹),例如:
http://example.com/mypage1.php?id=123
应该可以通过以下方式访问:
http://example.com/mypage1/page/123
和mypage2.php、page3.php等一样
【问题讨论】:
-
是的,你可以删除它,它不会,但我不是那个。请看下面的答案和它的cmets
-
不需要那个。找到了另一个删除 .php 的解决方案,它与下面的答案一起工作得很好
标签: .htaccess mod-rewrite