2011-04-01 53 views

回答

3

见例如".htaccess fix for a pretty permalink in PHP?"。此外,你应该能够找到大量的教程mod_rewrite(和relatedquestions)。

试用:

RewriteRule ^index/([0-9]+)$ index.php?id=$1 [QSA,L] 
+0

我在做内部服务器时出现了500个错误 – Raghs 2011-04-01 08:46:34

+0

@Raghs好的,您是否开启了'RewriteModule On'?如果是,'mod_rewrite'可能未启用。试试['phpinfo()'](http://php.net/manual/en/function.phpinfo.php)来验证。这是[可能](http://textpattern.com/weblog/135/partly-messy-clean-urls-without-modrewrite-experimental)没有'mod_rewrite',(但很难得到正确的)。 – jensgram 2011-04-01 08:49:12

+0

@jensgram我需要更新的永久链接 http://www.example.info/index.php?wiki=india 我想将其更改为 http://www.example.com/wiki/india 我有此示例代码在我的htaccess,但它不工作 RewriteEngine叙述上 RewriteBase/ 重写规则^指数/([0-9A-Z] +)$的index.php?维基= $ 1 [QSA,L] – Raghs 2011-04-01 08:57:02

0

您可以使用generateit创建阿帕奇重写规则,如果你使用的nginx然后使用gdix转换的Apache的.htaccess规则。