Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
251 views
in Technique[技术] by (71.8m points)

javascript - Nginx: redirect any pathname to it's subfolder

I've a static website contains html files inside different folders, here's an example about the structure:

index.html
-- folder1
---- folder1.html
-------folderXInsideFolder1
--------- X.html

-- folder2
---- folder2.html
-------folderYInsideFolder2
--------- Y.html

I'd like to redirect the user to the desired .HTML file by the following pattern:

www.website.com --> redirect to index.html
www.website.com/folder1 --> redirect to folder1.html
www.website.com/folder1/X --> redirect to X.html

www.website.com/folder2 --> redirect to folder2.html
www.website.com/folder2/Y --> redirect to Y.html
question from:https://stackoverflow.com/questions/65644270/nginx-redirect-any-pathname-to-its-subfolder

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...