【问题标题】:Too many redirects .htaccess重定向太多 .htaccess
【发布时间】:2019-09-11 04:31:37
【问题描述】:

我有网站。在以前的主机上,.htaccess 文件没有任何问题。 现在我对TOO_MANY_REDIRECTS 有一些问题。 我需要将所有请求从yzerkalo.ruwww.yzerkalo.ru 重定向到https://** 我有这个.htaccess 文件:

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>

我做错了什么? 这就是我在谷歌浏览器中看到的

【问题讨论】:

  • @Emma 不,没用(
  • @Emma 你是什么意思?
  • @KoenHollander Emma 之前使用此链接
  • 为什么这段代码可以在zerkalo3x.ru 上工作,但在这里不能工作??
  • @Emma 我正在添加慢速 3g 的图像加载

标签: php .htaccess vds


【解决方案1】:

试试这个。

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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-15
    相关资源
    最近更新 更多