Php 尝试为Apache负载平衡器声明自定义cookie时出错
我已经学习了许多教程(如),并设置了一个Apache负载平衡器,除了会话维护之外,它工作正常 我正在尝试修改重定向(直到添加额外标志(?): 这会导致内部服务器错误:Php 尝试为Apache负载平衡器声明自定义cookie时出错,php,apache,.htaccess,session,cookies,Php,Apache,.htaccess,Session,Cookies,我已经学习了许多教程(如),并设置了一个Apache负载平衡器,除了会话维护之外,它工作正常 我正在尝试修改重定向(直到添加额外标志(?): 这会导致内部服务器错误: C:/Web Server/Apache24/htdocs/.htaccess: RewriteRule: bad flag delimiters 因此,我的会话不会保留在两台服务器之间 我正在Windows server 2013上使用Apache2.4和PHP5.5.11 我怎样才能解决这个问题 如果你需要我提供更多的细节,
C:/Web Server/Apache24/htdocs/.htaccess: RewriteRule: bad flag delimiters
因此,我的会话不会保留在两台服务器之间
我正在Windows server 2013上使用Apache2.4和PHP5.5.11
我怎样才能解决这个问题
如果你需要我提供更多的细节,请这样说
我已经做出了改变:
RewriteRule ^(.*)$ - [CO=JSESSIONID:balancer.view-a:.ea-hq.com]
RewriteRule ^(.*)$ public_html/index.php
但是现在很多文件没有加载,状态为302“Found”,通过Chrome中的inspector查看时为空
给我同样的结果
这是我的完整.htaccess文件,没有修改cookie:
Options +FollowSymLinks
IndexIgnore */*
<FilesMatch "\.(ico|pdf|flv|jpe?g|png|gif|js|css|swf|eot|woff|ttf|svg)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>
RewriteEngine On
RewriteBase /
# Ignore rule if the real path exists, use that instead.
RewriteCond %{REQUEST_FILENAME} !-f
# Only use the filename and extension.
RewriteRule ^(?:[^/]+/)*([^.]+\.(?:gif|jpe?g|png|eot|woff|ttf|svg))$ public_html/images/$1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/importers
RewriteCond %{REQUEST_URI} !\.(gif|jpg|png)$
RewriteRule ^(.*)$ public_html/index.php
# Use below when apache is upgraded.
#FallbackResource public_html/index.php
#php_flag session.bug_compat_42 1
#php_flag session.bug_compat_warn 0
<IfModule mod_security.c>
SecRuleEngine Off
</IfModule>
Options+FollowSymLinks
IndexIgnore*/*
过期于
ExpiresDefault“访问权限加1年”
重新启动发动机
重写基/
#忽略规则如果实际路径存在,则使用该规则。
重写cond%{REQUEST_FILENAME}!-f
#仅使用文件名和扩展名。
重写规则^(?:[^/]+/)*([^.]+\(?:gif | jpe?g | png | eot | woff | ttf | svg))$public\u html/images/$1[R,L,NC]
重写cond%{REQUEST_FILENAME}!-f
#重写cond%{REQUEST_FILENAME}!-d
重写条件%{REQUEST_URI}!^/导入程序
RewriteCond%{REQUEST_URI}!\(gif|jpg|png)$
重写规则^(.*)$public_html/index.php
#在升级apache时使用以下命令。
#FallbackResource public_html/index.php
#php_flag session.bug_compat_42 1
#php_flag session.bug_compat_警告0
关闭发动机
重写规则需要2或3个参数,您的命令有4个参数
正确的语法是
- 命令:重写规则
- 模式:^(.*)$
- 替换:-
- 标志:[CO=JSESSIONID:balancer.view-a:.ea hq.com]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public_html/index.php/$1 [L,CO=JSESSIONID:balancer.view-a:.ea-hq.com]
查看更多信息我已经做了更改,但现在我的大多数文件(css等)没有正确加载,状态为302“已找到”。您是否尝试使用单一规则?
RewriteRule^(.*)$public\u html/index.php[CO=jssessionid:balancer.view-a:.ea hq.com]
@arino Di Clemente是的,我得到了相同的结果:(我认为问题与重写规则有关,而不是与规则配合良好的cookie标志有关。这是关于规则的文档,我建议您一步一步地进行,它开始创建您感兴趣的重写规则,当它起作用时,添加到固有的cookie中。我已经更改了答案,但我猜这是某种编程,您可能会更幸运地找到服务器故障的答案。
Options +FollowSymLinks
IndexIgnore */*
<FilesMatch "\.(ico|pdf|flv|jpe?g|png|gif|js|css|swf|eot|woff|ttf|svg)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>
RewriteEngine On
RewriteBase /
# Ignore rule if the real path exists, use that instead.
RewriteCond %{REQUEST_FILENAME} !-f
# Only use the filename and extension.
RewriteRule ^(?:[^/]+/)*([^.]+\.(?:gif|jpe?g|png|eot|woff|ttf|svg))$ public_html/images/$1 [R,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/importers
RewriteCond %{REQUEST_URI} !\.(gif|jpg|png)$
RewriteRule ^(.*)$ public_html/index.php
# Use below when apache is upgraded.
#FallbackResource public_html/index.php
#php_flag session.bug_compat_42 1
#php_flag session.bug_compat_warn 0
<IfModule mod_security.c>
SecRuleEngine Off
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public_html/index.php/$1 [L,CO=JSESSIONID:balancer.view-a:.ea-hq.com]