以下 htaccess 规则有什么问题
what's wrong with the following htaccess rules
您好,我修复了一个站点上的错误,效果非常好(?)。这是一个 HTTP 500 错误。
这是由 htaccess 文件引起的。但我无法弄清楚代码有什么问题。这是代码。
# Use PHP5 Single php.ini as default
#AddHandler application/x-httpd-php5s .php
# The rules below basically say that if the file exists in the tree, just
# serve it; otherwise, go to index.php. This is more future-proof for your
# site, because if you start adding more and more content types, you don't
# need to alter the .htaccess to accomodate them.
# This is an important concept for the Front Controller Pattern which the
# ZF MVC makes use of.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ public/index.php [NC,L]
Redirect 301 /platforms/mt4-ecn http://example.com/
Redirect 301 /partnerships/mt4-to-mt4-bridge http://example.com/
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/aaaecn/public_html
</IfModule>
<Files php.ini>
order allow,deny
deny from all
</Files>
此重定向规则适用于 zend 框架,但我没有任何使用该框架的经验。
我评论了所有行并尝试现在 500 错误已修复。所以我通过取消注释过滤掉它。
RewriteRule ^.*$ - [NC,L]
此行导致错误,但删除此行会导致无效重定向和 404 错误。我该怎么做才能解决这个问题。
像这样尝试你的规则:
RewriteEngine On
RewriteRule ^(partnerships/mt4-to-mt4-bridge|platforms/mt4-ecn)/?$ / [L,NC,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]
您好,我修复了一个站点上的错误,效果非常好(?)。这是一个 HTTP 500 错误。 这是由 htaccess 文件引起的。但我无法弄清楚代码有什么问题。这是代码。
# Use PHP5 Single php.ini as default
#AddHandler application/x-httpd-php5s .php
# The rules below basically say that if the file exists in the tree, just
# serve it; otherwise, go to index.php. This is more future-proof for your
# site, because if you start adding more and more content types, you don't
# need to alter the .htaccess to accomodate them.
# This is an important concept for the Front Controller Pattern which the
# ZF MVC makes use of.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ public/index.php [NC,L]
Redirect 301 /platforms/mt4-ecn http://example.com/
Redirect 301 /partnerships/mt4-to-mt4-bridge http://example.com/
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/aaaecn/public_html
</IfModule>
<Files php.ini>
order allow,deny
deny from all
</Files>
此重定向规则适用于 zend 框架,但我没有任何使用该框架的经验。
我评论了所有行并尝试现在 500 错误已修复。所以我通过取消注释过滤掉它。
RewriteRule ^.*$ - [NC,L]
此行导致错误,但删除此行会导致无效重定向和 404 错误。我该怎么做才能解决这个问题。
像这样尝试你的规则:
RewriteEngine On
RewriteRule ^(partnerships/mt4-to-mt4-bridge|platforms/mt4-ecn)/?$ / [L,NC,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ public/index.php [L]