mod_rewrite - 带子目录的URL

时间:2013-08-31 20:02:14

标签: regex apache mod-rewrite

我正在尝试更改此网址: 的 example.com/stickit/note.php?note=1
对此: 的 example.com/stickit/note/1

我试过这样做,但我得到的是404错误:

RewriteEngine On
RewriteRule ^stickit/note/(.*)$ /stickit/note.php?note=$1 [L]

有趣的是,这有效:

RewriteEngine On
RewriteRule ^note/(.*)$ /stickit/note.php?note=$1 [L]

更改 example.com/stickit/note.php?note=1
to: example.com/note/1

1 个答案:

答案 0 :(得分:0)

沿着这些方向尝试一些事情......

RewriteEngine On
RewriteRule ^note/(.*)$ /stickit/note/$1 [L]

我还撰写了一篇博客文章,可以帮助您更好地理解Apache重写......

http://www.jabcreations.com/blog/apache-domain-neutral-redirect

始终确保您关注Apache访问和错误日​​志,它们将帮助您了解正在发生的事情。

相关问题