从URL删除index.php后,会话随机丢失

时间:2016-11-08 07:43:21

标签: php apache .htaccess mod-rewrite joomla3.0

我在joomshopping上有电子商务应用程序(即joomla的电子商务扩展),我已经从URL删除了index.php。现在,购物车会话在任何步骤都会自动随机销毁 为了删除index.php,我从joomla admin 启用了搜索引擎友好URL和URL重写。我正在使用ubuntu14.04并将.htaccess文件放在根目录下。

我的应用程序放在子目录名称http://www.example.com/demoinstance中。

我对SEF网址进行了以下更改: -

1).htaccess代码

##
# @package    Joomla
# @copyright  Copyright (C) 2005 - 2014 Open Source Matters. All rights reserved.
# @license    GNU General Public License version 2 or later; see LICENSE.txt
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
## Can be commented out if causes errors, see notes above.
#Options +FollowSymLinks
## Mod_rewrite in use.

<FilesMatch "\\.(html|htm|php|js)$">
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
</FilesMatch>

RewriteEngine On

#RewriteCond %{HTTP_HOST} ^example.com/demoinstance [NC]
#RewriteRule ^(.*)$ http://www.example.com/demoinstance/$1 [L,R=301,NC]
## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
# Block out any script trying to base64_encode data within the URL.

RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.

RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.

RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.

RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage

RewriteRule .* index.php [F]
## End - Rewrite rules to block out some common exploits.
## Begin - Custom redirects
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
## End - Custom redirects
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).

RewriteBase /demoinstance/
## Begin - Joomla! core SEF Section.

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script

RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file

RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder

RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script

RewriteRule .* index.php [L]
##End - Joomla! core SEF Section.

2)在/etc/apache2/sites-available/000.default.conf中: -

<Directory '/var/www/html'>
AllowOverride All
</Directory>

3)Gzip未启用。

4)在phpinfo中: -

session.save_path   /var/www/html/example/session   /var/www/html/demoinstance/session

5)提琴手回答: - 没有404/302错误。 303/403/202即将到来。

请帮帮我。我在过去20天内遇到了这个问题,但没有找到任何解决方案。

提前致谢。

0 个答案:

没有答案