0

After copying the forum to another host the Login doesn't work. I suppose that the problem comes from the way I set the virtual host.

Nginx proxy:

server {
    listen 443 ssl;
    server_name example.com;

    location /forum/ {
        rewrite  ^/forum/(.*) /$1 break;
        proxy_pass http://127.0.0.1:6666;
        ...
    }
}

Apache virtual host:

<VirtualHost 127.0.0.1:6666>
    ServerName example.com
    DocumentRoot /my/web/dir/forum

    <Directory /my/web/dir/forum>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
</VirtualHost>

.htaccess

<IfModule mod_rewrite.c>
  Options -MultiViews

  RewriteEngine On

  RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . rewrite.php [L]
</IfModule>

config.php

$base_url = 'https://example.com/forum';

This was the only way I succeed at least to show the forum. However, the login and probably other stuff doesn't work.

When I try to log in, the "Confirm action" appears with wrong links in the form.

<form method="post" action="https://example.com/login/">
    <div class="hidden">
        <input type="hidden" name="prev_url" value="https://example.com/login/">
        <input type="hidden" name="redirect_url" value="https://example.com/">
        ...
    </div>
    ...
</form>

The correct links are https://example.com/forum/login

How to solve the problem or to make the virtual hosting in a better way?

Edit:

On the old hosting the .htaccess has RewriteBase /forum, however with it, the forum doesn't work here. If I remove rewrite ^/forum/(.*) /$1 break;, it gives "Request exceeded the limit of 10 internal redirects due to probable configuration error."

Miroslav Popov
  • 3,294
  • 4
  • 32
  • 55
  • 1
    What is `rewrite ^/forum/(.*) /$1 break;` rewrite rule for? Try what happens without it. – Ivan Shatsky Oct 24 '20 at 17:42
  • This is something very questionable. However, without it, it rises `circular reference` (or similar) 10 times a termination of the request. I agree it would look better without it and `RewriteBase /forum` as in the old hosting. – Miroslav Popov Oct 24 '20 at 17:47

0 Answers0