Vote count:
0
I have a new CodeIgniter instalation and I want to create a login form. When I submit the page it collects no data in POST. This seems to be a server configuration issue rather than CodeIgniter, but I can't figure it out.
My view:
<form class="navbar-form navbar-right" role="form" action="/administrator/login/submit" method="post" accept-charset="utf-8">
...
</form>
My controller
<?php
class Login extends CI_Controller
{
function index()
{
$this->load->view("administrator/login_view");
}
function submit()
{
$this->output->enable_profiler();
//var_dump($_POST);
var_dump($_REQUEST);
}
}
Codeigniter is in /var/www/html/sub/
/var/www/html/sub$ ls
application index.php license.txt skins system user_guide
My .htaccess in /var/www/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sub/index.php?/$1 [L]
RedirectMatch 301 ^/$ /administrator/login/
<Files "index.php">
AcceptPathInfo On
</Files>
My apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I browse to the url (page loads correctly redirecting to IP/sub/http://ift.tt/1kqiyBd)
http://{SERVER_IP}/administrator/login/
Enter user/password and click submit. But then I don't get anything back, POST is empty.
Output of $_POST
array(0) { }
Output of $_REQUEST
array(1) { ["/html/administrator/login/submit"]=> string(0) "" }
Apparently, maybe I'm wrong, the problem is the fact that the request takes that extra /html in the URI. I also noticed that when I installed Apache 2.4 it created an html folder in /var/www/ which is the default folder if I browse to the server. So how can I make the post to go to "/administrator/login" instead of "/html/administrator/login" - if I am correct and that is my issue here? Funny thing that even with the prefix the controller is still called, if I do an
echo "Hello";
in the controller then I can see that in the browser, it's just the POST is empty It looks like the "html" folder is set in
/etc/apache2/sites-available/default-ssl.conf
/etc/apache2/sites-available/000-default.conf
For port 443 and 80 respectively.
So here I am, having all these details but being unable to connect the dots. Please help
Aucun commentaire:
Enregistrer un commentaire