Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL redirection using docker #3407

Closed
xgaia opened this issue May 5, 2020 · 6 comments
Closed

URL redirection using docker #3407

xgaia opened this issue May 5, 2020 · 6 comments

Comments

@xgaia
Copy link

xgaia commented May 5, 2020

Environment

Python Version: 3.7.7

Nikola Version: 8.0.4

Operating System: Docker nginx-alpine

Description:

I use a docker nginx-alpine to deploy my nikola website to a specific port, and urls are not correctly redirected.

How to reproduce:

docker pull askomics/website
docker run --name website -d -p 8008:80 askomics/website

then, go to localhost:8008

putting the mouse on News show that the link is localhost;8008/news, but when I click on it, it redirect me to localhost/new/

How can I get the right redirection ?

@ralsina
Copy link
Member

ralsina commented May 5, 2020

Usually that should work. What is your SITE_URL setting?

@Kwpolska
Copy link
Member

Kwpolska commented May 5, 2020

Use links that end in slashes, i.e. /news/. All web servers will redirect links to folders like this, so to avoid the redirect, you must add the slash yourself.

PS. Pipenv is a bad product and not recommended for Nikola.

@Kwpolska Kwpolska closed this as completed May 5, 2020
@xgaia
Copy link
Author

xgaia commented May 5, 2020

Use links that end in slashes, i.e. /news/. All web servers will redirect links to folders like this, so to avoid the redirect, you must add the slash yourself.

I had end slashes

NAVIGATION_LINKS = {
    DEFAULT_LANG: (
        ("/news/", 'News'),
    ),
}

NAVIGATION_ALT_LINKS = {
    DEFAULT_LANG: (
        ("/about/", "About"),
    ),
}

It works on the main page, but if I go to a page (about), the navbar still show links without the end slashes

@xgaia
Copy link
Author

xgaia commented May 5, 2020

It work when I set PRETTY_URLS = True Thanks for your help !

@Kwpolska
Copy link
Member

Kwpolska commented May 5, 2020

When I tested your site, PRETTY_URLS was enabled, but the slashes in NAVIGATION_LINKS were missing.

@xgaia
Copy link
Author

xgaia commented May 5, 2020

Yes, I've tried several combinations. Work with PRETTY_URLS enabled and NAVIGATION_LINKS with end slashes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants