HTACCESS规则正在与会话变量混乱
我对会话变量有问题。该网站目前托管在000webhost上。下面是我的htaccess文件在“ public_html”文件夹\ public_html \ .htaccess
的根源中,
php_flag output_buffering on
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
这些会话存储在public_html级别的“ tmp”文件夹中\ code> \ tmp
i'''''''''''''' m在public_html文件夹中的index.php中使用以下代码\ public_html \ index.php
要管理fetch api cors
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: *");
......
$urlpath = explode("/",rawurldecode($_SERVER['REQUEST_URI']));
$ urlPath
varible将定义哪个页面将加载。我正在从资产
文件夹和PHP页面中提供静态资产(ex:ex:platform1
,platform2
),所有这些文件都在将级别保存为上述htaccess文件\ public_html \ Assets
& \ public_html \ Platform1
Platform1
文件夹创建和存储会话变量,以便可以通过多个页面访问它们。
现在的问题是,如果提供了HTACCESS规则,则不会存储会话变量。如果我删除重写规则,则会变量可完美。
我不擅长PHP功能,尤其是HTACCESS重写规则。一种非理想的方法是在每个页面加载上生成所有会话变量,以增加页面加载时间,因此我想将其保留为最后的度假胜地。
I'm having an issue with session variables. The site is currently hosted on 000webhost. Below is my htaccess file inside the root of "public_html" folder \public_html\.htaccess
php_flag output_buffering on
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
The sessions are being stored in "tmp" folder at the public_html level \tmp
I'm using the below code in the index.php inside public_html folder \public_html\index.php
to manage a fetch API CORS
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: *");
......
$urlpath = explode("/",rawurldecode($_SERVER['REQUEST_URI']));
The $urlpath
variable will define what page will load. I'm serving static assets from assets
folder and PHP pages from different folder (ex: platform1
,platform2
) and all of them are at the save level as the above htaccess file \public_html\assets
& \public_html\platform1
The PHP files inside the platform1
folder create and store session variables so they can be accessed across multiple pages.
The problem now is if the htaccess rules are provided, session variables are not stored. If I remove the rewrite rules, session variables work perfectly.
I'm not adept at PHP functions, especially with the htaccess rewrite rules. One non-ideal way is to generate all the session variables on every page load which increases the page load times and such I'd like to keep this as a last resort.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论