2015-10-07 39 views
2

我有我的网站运行在SSL上,但我添加了一个游戏部分,使用闪存中的第三方游戏。当我启用SSL时,它停止工作。我很奇怪,如果我只能禁用该网址中包含“/ game /”的特定页面上的SSL,以便游戏正常运行。如何禁用SSL,如果一个页面url包含一个特定的字

我试图从insternet这个代码在我的.htaccess文件,但不工作:

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> 

需要帮助。如果发现任何重复,请告知我,但我找不到任何人。 谢谢。

+0

如果您在.htaccess文章中有更多规则,请在此完成.htaccess。 – anubhava

+0

我添加了完整的代码。 – M3Dev

回答

0

这应该是你完全的.htaccess:

<IfModule mod_rewrite.c> 
    Options +FollowSymLinks 
    RewriteEngine On 

    # except for /game/ enforce https 
    RewriteCond %{HTTPS} off 
    RewriteCond %{THE_REQUEST} !/game/ [NC] 
    RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

    # for /game/ enforce http 
    RewriteCond %{HTTPS} on 
    RewriteCond %{THE_REQUEST} /game/ [NC] 
    RewriteRule^http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

    # Get rid of index.php 
    RewriteCond %{REQUEST_URI} /index\.php 
    RewriteRule (.*) index.php?rewrite=2 [L,QSA] 

    # Try to route missing files 
    RewriteCond %{REQUEST_FILENAME} public [OR] 
    RewriteCond %{REQUEST_URI} \.(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> 

确保测试这种变化之前,清除浏览器缓存。

+0

它给你我的错误“ERR_TOO_MANY_REDIRECTS”与你相同的htaccess文件。 – M3Dev

+0

这意味着你仍然在浏览器中拥有旧的缓存。在停用缓存的Chrome开发工具中进行测试。然后在'Network'选项卡中监控您看到301/302重定向的URL。顺便说一句'/游戏/'也有一个.htaccess? – anubhava

+0

我尝试了你的建议,使用禁用缓存选项以及私人浏览也我使用zend应用程序中没有模块中的htaccess文件,游戏是一个模块。根目录中只有一个htaccess文件。 – M3Dev

相关问题