1 (edited by Popov 2020-10-24 17:55)

Topic: Problem with setting redirections on a new hosting

Hello,

I'm using PunBB from 14 years and I'm very happy with it. Now my hosting company Webfaction terminates work and I'm moving on another hosting. However, I cannot set the forum properly.

The problem is that when I'm trying to log in, it redirects to https://hostanme/login but the actual rout must be https://hostname/forum/login. It is PunBB 1.4.5

I suppose that the problem comes from the way I set virtual hosts.

Nginx proxy:

server {
    listen 443 ssl;
    server_name example.com;

    index index.html;
    root /my/web/dir;

    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

Please help me to solve the problem or to make virtual hosting in a better way.

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."

I'm using PunBB at Forex Forum since 2006.