在差异重写mod在Apache 1.3和2.2 [英] diff in mod rewrite on apache 1.3 and 2.2
问题描述
是什么的Apache 1.3之间(0.37)和2.2(0.11)?在mod_rewrite的区别
What is the difference in mod_rewrite between Apache 1.3(.37) and 2.2(.11)?
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^pages/edit(account|page)/([0-9]+)*$ ./index.php?p=edit$1&id=$2
RewriteRule ^pages/([\w'-]+)*$ ./index.php?p=$1
我写了这一点,它的作品在我的机器,这是运行Apache 2.2.11,但它需要运行在生产服务器就是Apache 37年3月1日。我是真正的新mod-rewrite和刚刚开始今天上午学习正则表达式。我在哪里可以从这里走?
I wrote this and it "works on my machine" which is running Apache 2.2.11 but the production server that it needs to run on is Apache 1.3.37. I am really new to mod rewrite and just started learning regex this morning. where do i go from here?
更新:我在我的本地机器上安装的Apache 37年3月1日。我收到错误无效命令'RewriteEngine叙述',也许是拼写错误由模块或定义不包含在服务器配置。
update: I installed Apache 1.3.37 on my local machine. I am getting the error "Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration".
更新2:我固定问题,我与我的本地机器。现在我得到同样的问题,因为在生产服务器上。
update 2: I fixed the problem i had with my local machine. now i am getting the same issue as on the production server.
推荐答案
1的Apache的 X 的用途的 POSIX扩展正防爆pressions 的那些不明白速记字符类如 \\ W
。所以,试试这个:
Apache 1.x uses POSIX Extended Regular Expressions and those don’t understand shorthand character classes like \w
. So try this:
RewriteRule ^pages/edit(account|page)/([0-9]+)$ ./index.php?p=edit$1&id=$2
RewriteRule ^pages/([A-Za-z0-9_'-]+)$ ./index.php?p=$1
这篇关于在差异重写mod在Apache 1.3和2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!