drbfxb977777 2015-08-24 23:21
浏览 72

.htaccess一致的“请求超过了10个内部重定向的限制......”(包含代码)

I'm having some very strange issues.

I'm running my application on AWS Elastic Beanstalk, my .htaccess file is at the root of the accessible web level of my application.

I'm constantly seeing issues in my error log, it seems with every request I'm getting the "Request Exceeded The Limit Of 10 Internal Redirects" message. Although, pages are loading and working fine, the fact these errors are throwing and my load on the server is far higher than it should be is indicating to me there's a problem somewhere.

I'm not extremely familiar with .htaccess files as I haven't written them for 2 years or so now, and this one is for an old MVC framework I built (though never had problems with until now)

Any help would be appreciated, I'm not sure where to look at this point.

.htaccess file:

# -*- mode: apache -*-

AddDefaultCharset utf-8

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript image/jpg image/jpeg image/png image/gif video/mp4
</ifmodule>

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^[^\.]+\.[^\.]+$
RewriteRule ^.*$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* - [L]

RewriteRule ^(\d+\/)?assets/(.*)$ assets/$2 [L]
RewriteRule .*$ app/index.php [L]
  • 写回答

1条回答 默认 最新

  • douwei8096 2015-08-25 05:28
    关注

    Have your rules as this:

    Options +FollowSymlinks
    RewriteEngine on
    
    RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
    RewriteRule ^.*$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    RewriteRule ^\d+/(assets/.*)$ $1 [L,NC]
    
    # skip all files and directories from rewrite rules below
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    
    RewriteRule ^ app/index.php [L]
    

    Keep assets rule before skip files/directories rule and don't make \d+/ part optional.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。