2011-03-06 57 views
0

我有这个网站。让我们把它叫做HTP://www.mysite.comMod_rewrite适用于本地,不适用于远程版本?

我有一个重写规则改变htp://www.mysite.com/?q=words%20etc/0/10http://www.mysite.com/words%20etc/0/10(或或http://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行,甚至是重写引擎行。我没有尝试删除条件,因为我认为我不应该这样做,我可能是错的。

+0

它可能与v1.3 apache服务器有关 - 它与v2有明显的不同;它在过去使用mod_rewrite多次触发了我。但是真的,你的远程主机应该已经升级了 - Apache 1.3在一年前被宣布寿终正寝了。这并不是说v2是新的未经测试的。 – Spudley

+0

我会从旧的1.3时代的mod_rewrite文档开始:http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule – canuckistani

回答

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。

相关问题