简体   繁体   English

该页面未在EC2上正确重定向

[英]The page isn’t redirecting properly at EC2

Dears, i have this problem when i tried to access my site 亲爱的,我试图访问我的网站时遇到此问题

The page isn't redirecting properly 页面未正确重定向

I Think there are problem at .htaccess 我认为.htaccess存在问题

This is my .htaccess Code, I got it when i active AllowOverride All at httpd 这是我的.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>

The problem seems to be in your first rewriteRule. 问题似乎出现在你的第一个rewriteRule中。 You are redirecting the SERVER_PORT 80 (http) back to the same server port. 您正在将SERVER_PORT 80(http)重定向回同一服务器端口。 Try changing the Rule's destination to 尝试将规则的目的地更改为

 https://yoursite/$1 [L,R]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM