【发布时间】:2016-01-04 06:50:13
【问题描述】:
我的网站在整个 SSL 上运行,但我添加了一个使用 Flash 中的 3rd 方游戏的游戏部分。当我启用 SSL 它停止工作。我想知道我是否只能在 URL 中包含“/game/”的特定页面上禁用 SSL,以便游戏能够正常运行。
我在我的 .htaccess 文件中尝试了来自 insternet 的这段代码,但没有工作:
RewriteCond %{HTTPS} off
RewriteRule ^game^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
编辑:
我尝试了建议的答案:
RewriteEngine On
RewriteCond %{HTTPS} On [NC]
RewriteRule ^game http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NC]
它有效,但是当我转到包含“游戏”一词的页面时,它会将其他页面也变成“http”,并且其他页面使用“http”而不是“https”
然后我尝试了这个:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} On [NC]
RewriteRule ^game http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NC]
当我转到“游戏”页面 url 时,它开始给我消息“页面未正确重定向”。
我只希望“游戏”页面使用“http”。
编辑二:完整的 .htaccess 文件
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Get rid of index.php
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]
# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]
# Try to route missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]
# If the file doesn't exist, rewrite to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]
</IfModule>
# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On
# @todo This may not be effective in some cases
FileETag Size
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
需要帮助。如果找到任何重复项,请告诉我,但我找不到任何人。 谢谢。
【问题讨论】:
-
如果您的 .htaccess 帖子中有更多规则,请在此处填写 .htaccess。
-
我添加了完整的代码。
标签: .htaccess mod-rewrite ssl https url-redirection