重定向不存在的页面适用于 domain.com/asdasd,但不适用于 domain.com/index.php/page.html - Confluence

重定向不存在的页面适用于 domain.com/asdasd,但不适用于 domain.com/index.php/page.html - Confluence

我已将我的网站从 Wordpress 迁移到 Confluence,并修改了 404 错误页面以重定向到主域主页。如果我输入

https://www.freesoftwareservers.com/asdasd

但如果你去一个旧页面,比如说

https://www.freesoftwareservers.com/index.php/2016/07/24/xymon-home-page/

它会带您进入主汇合页面,这不是我想要的。

工作重定向,将您重定向到“滚动点视口”@

https://www.freesoftwareservers.com/wiki

但是上面无效的 URL 只会将您带到我通常使用的 Confluence 页面,而该页面实际上不应公开。(尽管它仍然受到保护,但不够美观,也不是我想要公开的视图)

有什么想法吗?

PS:这是我用 Confluence 处理 404 的方法(所有页面都通过 NGinX 代理)

sudo mv /opt/atlassian/confluence/confluence/404.vm /opt/atlassian/confluence/confluence/404.vm.original
sudo nano /opt/atlassian/confluence/confluence/404.vm
<!DOCTYPE HTML>

<meta charset="UTF-8">
<meta http-equiv="refresh" content="1; url=http://example.com/url">

<script>
  window.location.href = "http://example.com/url"
</script>

<title>Page Redirection</title>

<!-- Note: don't tell people to `click` the link, just tell them that it is a link. -->
If you are not redirected automatically, follow the <a href='link'>http://example/url'>link to example</a>

NginX 配置

##Jira
server {
       listen         80;
       server_name    jira.freesoftwareservers.com;

       return         301 https://$server_name/;

}

server {
        listen 443 ssl;
        server_name jira.freesoftwareservers.com;

location / {

        proxy_pass              http://192.168.1.255:8081/;

        include                 /etc/nginx/proxy.conf;
    }
}


#Confluence
server {
       listen         80;
       server_name    freesoftwareservers.com www.freesoftwareservers.com;

       return         301 https://www.freesoftwareservers.com$request_uri;
}

server {
listen 443 ssl;
server_name www.freesoftwareservers.com freesoftwareservers.com;

rewrite     ^/$ /wiki permanent;

location / {

      proxy_pass           http://192.168.1.255:8091/;
      include             /etc/nginx/proxy.conf;

    }
}

答案1

我用了

 rewrite ^/index.php /wiki permanent

使这个工作

相关内容