[英]The page isn’t redirecting properly at EC2
親愛的,我試圖訪問我的網站時遇到此問題
頁面未正確重定向
我認為.htaccess存在問題
這是我的.htaccess代碼,當我在httpd上激活AllowOverride All時,我得到了它
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/$1 [R,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
redirect 301 /PlaystationCards http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-PlaystationCards
redirect 301 /Mobile http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-Mobile
redirect 301 /Xbox http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-Xbox-USA
redirect 301 /Steam-Cards http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-SteamCards
redirect 301 /Nintendo http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-Nintendo-USA
redirect 301 /Games http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-Games
redirect 301 /beINSport http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-beIN
redirect 301 /paypal http://ec2-52-27-245-72.us-west-2.compute.amazonaws.com/All-Paypal-USA
<FilesMatch ".(zip|sql)$">
Order Allow,Deny
Deny from all
</FilesMatch>
<IfModule mod_headers.c>
# WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf|js|css)$">
# Header set Cache-Control "max-age=604800, public"
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</IfModule>
#Turn eTags Off
#By removing the ETag header, you disable caches and browsers from being able to validate files, so they are forced to rely on your Cache-Control and Expires header. Source
<IfModule mod_headers.c>
# Header unset ETag
</IfModule>
FileETag None
#Compress Text Files
<IfModule mod_deflate.c>
# Force compression for mangled headers.
# https://developer.yahoo.com/blogs/ydn/pushing-beyond-gzipping-25601.html
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
# as `AddOutputFilterByType` is still in the core directives).
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
application/javascript \
application/json \
application/rss+xml \
application/vnd.ms-fontobject \
application/x-font-ttf \
application/x-web-app-manifest+json \
application/xhtml+xml \
application/xml \
font/opentype \
image/svg+xml \
image/x-icon \
text/css \
text/html \
text/plain \
text/x-component \
text/xml
</IfModule>
</IfModule>
問題似乎出現在你的第一個rewriteRule中。 您正在將SERVER_PORT 80(http)重定向回同一服務器端口。 嘗試將規則的目的地更改為
https://yoursite/$1 [L,R]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.