When you jump to a page through the controller, the path of the page to access CSS, JS and other static resources changes

Time:2022-5-23

preface:

Recently, I made a boot project. When I jump to the HTML page through the controller layer, the CSS and JS paths in the page have changed. This problem has been bothered for a long time and has finally been solved. I hereby record it to prevent stepping on the pit again in the future.

1. Problem description

(1) First, the access path of the interface is / Wx / AA / education
image
(2) Next, let’s look at the project path
image
(3) Look at the page again, and the path can also be clicked in
image
(4) During the visit, JS and CSS found an additional layer
image

2. Problem solution

Before comparison, it will/ Instead/
Instead of searching from the upper level, search from the root directory
image

Recommended Today

[4.3.1] server installation PXC + haproxy built in docker swarm

https://www.jianshu.com/p/a3dba4d4aff5 (1) Docker PXC setup #Create a new folder and give permissions mkdir -p /home/log mkdir -p /home/data mkdir -p /home/mysql-files mkdir -p /home/backup chmod 755 /home/log chmod 755 /home/data chmod 755 /home/mysql-files chmod 755 /home/backup # images docker pull percona/percona-xtradb-cluster #Create network docker network create -d overlay –attachable swarm_test #View network IP docker network […]