douhuang2673 2019-04-21 20:50
浏览 159

太多的重定向.htaccess

I have web-site. At previously host i haven't any problem with .htaccess file. Now i have some problem with TOO_MANY_REDIRECTS. I need redirect all request from yzerkalo.ru or www.yzerkalo.ru to https://** I have this .htaccess file:

RewriteEngine On
RewriteBase /
php_flag display_errors Off

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteCond %{HTTP_HOST} ^www.yzerkalo\.ru$ [NC]
RewriteRule ^(.*)$ https://yzerkalo.ru/$1 [R=301,L]

RewriteRule ^sitemap\.xml$ sitemap.xml [L]


RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
RewriteRule ^.*$ index.php [L]

# One month for most static assets
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=2628000, public"
</filesMatch>

What i'm doing wrong? That's what i see in Google Chrome enter image description here

  • 写回答

1条回答 默认 最新

  • douhong1703 2019-04-22 10:38
    关注

    Try this.

    RewriteEngine On
    RewriteBase /
    php_flag display_errors Off
    
    RewriteCond %{HTTP_HOST} ^yzerkalo\.ru [NC]
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.yzerkalo.ru/$1 [R=301,L]
    
    RewriteRule ^sitemap\.xml$ sitemap.xml [L]
    
    
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [L]
    RewriteRule ^.*$ index.php [L]
    
    # One month for most static assets
    <filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
    Header set Cache-Control "max-age=2628000, public"
    </filesMatch>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探