首页 > 解决方案 > 使用 RewriteCond 仅从 URL 为每个会话设置一次 ENV .htaccess

问题描述

我有 URL http://test.site.com/testdbhttp://test.site.com/devdbhttp://test.site.com/otherdb 下面是 .htaccess 将 ENV REDIRECT_PATH 从 URL 设置为testdb/devdb/otherdb

RewriteCond $1 !^(index.php|maintenance.php|css|js|min|fonts|images|favicon.ico|apple-touch-icon.png|crossdomain.xml|robots.txt)
RewriteCond %{REQUEST_URI} !^.*/form\.php$
RewriteCond %{REQUEST_URI} !^/(umfrage)(/.*)?
RewriteRule ^([^/]+)(.*)?$ /index.php/$2 [E=PATH:$1,L]

登录后 URL 更改为http://test.site.com/dashboard因此更改我的 ENV 和代码中断,因为没有找到有效的数据库。这里 REDIRECT_PATH 更改为仪表板。我正在使用 Codeigniter 框架

标签: .htaccesscodeigniter-2

解决方案


推荐阅读