Mod_rewrite适用于本地版本,而不适用于远程版本?

时间:2011-03-06 16:57:36

标签: regex apache mod-rewrite

我有这个网站。我们称之为htp://www.mysite.com

我有一个重写规则,可将htp://www.mysite.com/?q=words%20etc/0/10更改为http://www.mysite.com/words%20etc/0/10(或http://www.mysite.com//0/10http://www.mysite.com/0/10

.htaccess:ErrorDocument 404 htp://www.mysite.com/404.html
options +FollowSymlinks
rewriteEngine on
rewriteCond %{REQUEST_URI} !-f
rewriteCond %{REQUEST_URI} !-d
rewriteCond %{REQUEST_URI} !index\.php
rewriteRule ^/?([^/]+?)?/?([0-9]+?)/([0-9]+?)$ index.php/%{THE_REQUEST} [NC] 

现在,这适用于我的本地apache 2.2.11服务器,没有错误。但是在我的主机的apache 1.3.41服务器上,我收到以下错误:

[Sat Mar 5 21:42:14 2011] [alert] [client [ip]] /home/_/public_html/mysite.com/.htaccess: RewriteRule: cannot compile regular expression '^/?([^/]+?)?/?([0-9]+?)/([0-9]+?)$'\n 

我认为这是一个古怪的关于apache版本,因为这个主机上的其他网站使用mod_rewrite毫不费力。

我尝试删除+followSymlinks行,甚至是重写引擎行。我没有尝试删除条件因为我认为我不应该这样做,我可能错了。

1 个答案:

答案 0 :(得分:0)

在这里回答:http://www.webmasterworld.com/apache/4277342.htm

我正在使用?大多是错的。当它工作时会发布解决方案。

ErrorDocument 404 /404.html
options +FollowSymlinks
rewriteEngine on
rewriteCond %{REQUEST_URI} !-f
rewriteCond %{REQUEST_URI} !-d
rewriteCond %{REQUEST_URI} !/index\.php
rewriteRule ^/?([^/]+)/([0-9]+)/([0-9]+)$ index.php?q=$1&s=$2&p=$3 [NC]
rewriteRule ^/?([0-9]+)/([0-9]+)$ index.php?q=&s=$1&p=$2 [NC]

fixeddddd。

相关问题