Htaccess代码正在创建永无止境的重定向

时间:2018-05-01 10:46:38

标签: php wordpress .htaccess mod-rewrite url-rewriting

我的htaccess文件中有以下内容,我的网站使用SSL。 如果我只保留第1部分,网站就可以运行。 否则如果我也添加第2部分,该网站不会打开;发生连续重定向。我想知道我做错了什么。这将有助于我解决问题。 mydomainname.com是我的网站域名。 请指教。

# Part 1

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.mydomainname.com/$1 [R,L]
#</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# Part 2

# Begin Disable hotlinking and leeching
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomainname.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/mydomainname [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
# End Disable hotlinking and leeching

<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>

## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES HEADER CACHING ##

Redirect 301 /programs/ /programs/
Redirect 301 /webinar/ /media/

# BEGIN EWWWIO

# END EWWWIO    

0 个答案:

没有答案