.htaccess - 使用 RewriteCond 仅从 URL 为每个会话设置一次 ENV .htaccess
问题描述
我有 URL http://test.site.com/testdb或http://test.site.com/devdb或http://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 框架
解决方案
推荐阅读
- visual-studio - 如何将 .Net Core 2.1 项目更改为 .Net Core 2.0 项目
- reactjs - React/Redux - 新道具 - 未调用 componentDidUpdate
- azure - U-SQL 错误 - 更改标识符以使用至少一个小写字母
- macos - 基于 REST 的 Cryptotokenkit 实现
- android - 如何从另一个类 React Native 更改 navigationOptions
- java - 无法压缩位图android studio
- javascript - discord.js-commando if else 循环
- google-app-engine - 将防火墙规则应用于谷歌云中的特定标签不起作用
- c# - 如何根据 WebAPI 中的参数绑定模型
- angular - Angular 4嵌套反应形式手动设置隐藏输入的值