该页面未在EC2

时间:2017-06-25 13:57:55

标签: php .htaccess redirect mod-rewrite amazon-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>

1 个答案:

答案 0 :(得分:0)

问题似乎出现在你的第一个rewriteRule中。您正在将SERVER_PORT 80(http)重定向回同一服务器端口。尝试将规则的目的地更改为

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