协议为http时提交表单问题

时间:2019-06-12 05:58:14

标签: php codeigniter http https

我们最近已切换到HTTPS,并且在提交登录表单时进入错误页面。

我看到我将URL用作http://而不是https://。但是,即使我使用纯http:// URL,也希望我的表单提交。

有人可以帮我吗?

3 个答案:

答案 0 :(得分:0)

在“ application / config / autoload.php”中。

添加..

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style>

或者您也可以添加控制器。

$autoload['helper'] = array('url');

或者代替帮助程序设置..您可以将以下代码添加到.htaccess底部。.

$this->load->helper('url');

答案 1 :(得分:0)

更改.htaccess文件

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{HTTP_HOST} ^yourDomainName\.com$ [NC]
RewriteRule ^ https://www.yourDomainName.com%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php(/[^\ ]*)?\ HTTP/
RewriteRule ^index\.php(/(.*))?$ yourDomainName.com/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

答案 2 :(得分:0)

您可以设置动态基本URL来解决此问题。在您的config / config.php中,尝试以下操作:

$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;