Oh Wan Sik
Oh Wan Sik

Reputation: 85

Redirect url without changing root

I want change url like this

mysite.org/myhtml5/index.html.txt
mysite.org/myhtml5/opera/index.html.txt
mysite.org/myhtml5/clicker/index.html.txt

To

mysite.org/myhtml5/index.html
mysite.org/myhtml5/opera/index.html
mysite.org/myhtml5/clicker/index.html

so i tried like this

location ~ $/index.html.txt {
return 302 $1/index.html;
}

But it's not working. Would you help me? T_T

and i'm a newbie so i don't know about rule or like something. let me know when i'm doing something wrong.

Upvotes: 1

Views: 61

Answers (2)

Oh Wan Sik
Oh Wan Sik

Reputation: 85

i solved.

location ~ /index.html.txt {
return 302 index.html
}

Upvotes: 0

Julien Mellerin
Julien Mellerin

Reputation: 412

Try this :

rewrite /(.*)$ /$1.txt last;

Upvotes: 1

Related Questions