1

我希望将每个 url 或文件重定向到 index.php,但有一些例外(见下文)。它在我的本地服务器上运行良好,但在真实服务器上却无法正常运行。

我的问题是,当我在浏览器 url 中键入这些文件时会打开像 collection.php 这样的文件,并被我的 htacess 忽略。这些文件也应该被重定向到我的 index.php。我能做些什么?

我的 htaccess:

# html5 pushstate (history) support:

AddHandler php5-cgi .php

AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm

<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /WALT/

#rewriteRule ^(([a-z0-9\-]+/)*[a-z0-9\-]+)$ $1/ [NC,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteCond %{REQUEST_URI} !/content/create/ [NC]
RewriteCond %{REQUEST_URI} !/img/ [NC]
RewriteCond %{REQUEST_URI} !/video/ [NC]
RewriteCond %{REQUEST_URI} !/favicon.ico [NC]
RewriteCond %{REQUEST_URI} !/cms/ [NC]
RewriteCond %{REQUEST_URI} !^/collection.php [NC]

RewriteRule (.*) index.php [L]

</ifModule>
4

1 回答 1

0

查看您的 Apache(或其他 Web 服务器)配置。在声明 VHOST 的 ConfigFile 中,请确保“AllowOverwrite”设置为“ALL”

最好的调试方法是临时激活 RewriteLogs。所以你看到错误可能在哪里。

于 2013-10-01T12:00:28.747 回答