首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >重定向.htaccess太多

重定向.htaccess太多
EN

Stack Overflow用户
提问于 2019-04-22 04:50:27
回答 1查看 41关注 0票数 0

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

代码语言:javascript
复制
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>

我哪里做错了?这就是我在Google Chrome中看到的

EN

回答 1

Stack Overflow用户

发布于 2019-04-22 18:38:20

尝尝这个。

代码语言:javascript
复制
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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55786645

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档