• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
method POST error 404 Not found

Hello friends

I've been able to solve any problem regarding Codeigniter. However, there is a single problem I just can't solve.

I am using some API written in Controllers. They work great. I get the parameters using $this->request->getPostGet('id'), and works like a charm. But if I change the method to POST, it always gives me the 404 not found. Same parameters, but POST instead of GET. In fact, I tried with no parameters needed, and still the 404 error.

I am a beginner level in apache+php programming, and I am very sure I am doing something wrong, but I just can't find a solution to this by google'ing. Does somebody have a clue to this problem?

This is the URL I use

The routing rule
$routes->get('api/consulta/soap/save/', 'MeetingApi::soapSave');

And the apache log says:
::1 - - [29/Jul/2020:22:34:15 -0500] "POST /api/consulta/soap/save HTTP/1.1" 404 - "-" "-"

htaccess file
# Disable directory browsing

Options All -Indexes

# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------

# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod...ewritebase
# RewriteBase /

# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

# Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]

# Ensure Authorization header is passed along
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    ErrorDocument 404 index.php

# Disable server signature start
    ServerSignature Off
# Disable server signature end

Guys, sorry...... it took me like 3 hours and I gave up with this.

Now I just found I must change
$routes->get('api/consulta/soap/save', 'MeetingApi::soapSave');
to this
$routes->post('api/consulta/soap/save', 'MeetingApi::soapSave');

Sorry about my question

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.