0

我们的主机最近将他们的 apache 服务器从 2.2 更新到 2.4,现在我们不断收到 500 Internal Server Error,我们的错误日志显示“RewriteCond: bad flag delimiters”。

我们的 .htAccess 文件如下所示。

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/views/.*$ #allows to access views folder and everything in it.
RewriteCond %{REQUEST_URI} !^test.php$ #allows to access views folder and everything in it.
RewriteCond %{REQUEST_URI} !^phonegapFunction.php$ #allows to access views folder and everything in it.
RewriteRule ^([a-zA-Z0-9æøå]*)\/?(\w*)\/?(.*)$ /app.php?team=$1&page=$2&value=$3 [L]

我们的主人说我们需要将 .htaccess 文件更新为 apache 2.4 规范,但是我们在这样做时遇到了问题,所以希望这里有人可以提供帮助。

提前致谢

4

1 回答 1

2

这是我在 Apache 2.2 和 2.4 中得到的

使用这样的 .htaccess 文件:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/views/.*$ #allows to access views folder and everything in it.
RewriteCond %{REQUEST_URI} !^test.php$ #allows to access views folder and everything in it.
RewriteCond %{REQUEST_URI} !^phonegapFunction.php$ #allows to access views folder and everything in it.
RewriteRule ^([a-zA-Z0-9æøå]*)\/?(\w*)\/?(.*)$ /app.php?team=$1&page=$2&value=$3 [L]

这是我在错误日志中得到的错误,对于两个版本:

/var/www/localhost/htdocs/.htaccess: RewriteCond: bad flag delimiters

但如果我删除评论:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/views/.*$ 
RewriteCond %{REQUEST_URI} !^test.php$  
RewriteCond %{REQUEST_URI} !^phonegapFunction.php$
RewriteRule ^([a-zA-Z0-9???]*)\/?(\w*)\/?(.*)$ /app.php?team=$1&page=$2&value=$3 [L]

没有错误,我可以很好地路由到 app.php。

于 2013-09-13T20:29:59.470 回答