url-rewrite - There is a problem with the rewrite url path address in Nginx
巴扎黑
巴扎黑 2017-05-16 17:26:14
0
1
616

There is a requirement in the system to transfer a certain url link address to another address. The model is similar to
localhost/wish/1234.jhtml automatically goes to localhost/community/detail/1234.jhtml.

Currently my configuration writing method for Nginx is

location ~ ^/wish/$ {
rewrite ^/(.*)$ ^/community/detail/$1 permanent;
}

But after running, the system prompts 404...How should I change this sentence? Thank you so much!

巴扎黑
巴扎黑

reply all(1)
洪涛

The configuration file is written incorrectly. Just write it as below. There is no need to put it under location.
rewrite ^/wish/(.*).jhtml$ /community/detail/.jhtml permanent;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template