Skip to content

Mithril not respecting base href #2377

Closed as not planned
Closed as not planned
@volnei

Description

@volnei

Mithril Version: 2.0.0-rc3

2.0.0-rc3

Im developing a multi language app using mithril where witch language have your directory. Eg.: /en/ /pt/ etc.

When running the application using Nginx and following http://localhost/pt/ the navigator is redirected to http://localhost.

The html file is:

<!DOCTYPE html>
<html>
	<head>
	    <meta charset="utf-8">
	    <meta http-equiv="x-ua-compatible" content="ie=edge; chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
		
		<title>...</title>

		<base href="/pt/"/>

		<link rel="icon" href="/img/favicon.ico">
		<meta name="theme-color" content="#E64545">
		<link href="https://fonts.googleapis.com/css?family=Montserrat:100,300,400,500,600" rel="stylesheet">
	<link href="main.d819cfc3a0cfab094b29.css" rel="stylesheet"></head>
	<body>
		<main id="main"></main>
	<script type="text/javascript" src="92f025ccf65eb904ad80.bundle.js"></script><script type="text/javascript" src="main.64bdb34fc2a6a3597db4.js"></script></body>
</html>

And the mithril config is:

m.route.prefix("")
m.route(document.querySelector("#main"), "/", {
	"/": layout(site),
	"/login": layout(login)
}

But in browser, the lang part for url is not respected and its automatically redirected to /.

Can anyone help me?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: QuestionFor issues that are purely questions about Mithril, not necessarily bug reports or suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions