301 Moved Permanently

I’m getting '301 Moved Permanently’ as response of a POST request on DreamHost VPS using Apache and returns the original page/form. Whats wrong?

I have used the following rule in my .htaccess:

    RewriteEngine On
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]

Request header:

    POST /Authentication/Login HTTP/1.1
    Host: example.com
    Proxy-Connection: keep-alive
    Content-Length: 38
    Pragma: no-cache
    Cache-Control: no-cache
    Origin: http:// www. example. com
    Upgrade-Insecure-Requests: 1
    Content-Type: application/x-www-form-urlencoded
    User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    Referer: http:// www. example. com/Authentication/Login
    Accept-Encoding: gzip, deflate
    Accept-Language: en-US,en;q=0.9,fa;q=0.8

And the response header is:

    1. Request URL:    http:// example. com/Authentication/Login
    2. Request Method:    POST
    3. Status Code:    301 Moved Permanently
    4. Remote Address:
    5. Referrer Policy:    no-referrer-when-downgrade

Found the solution. And I’ll write it maybe will help someone else.

We have a line of code in our configuration file like below:

define ('WebsiteRoot', 'http://example.com')

That will handle all action attributes on forms.
There was an option enabled on panel called http:// to http://www. redirect, which caused the bug.

That was stupid but we lost a lot of time.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.