Rename the url of the translated html files in the

2019-05-31 23:18发布

I am building a web app and trying to add two languages to the website. So I will make the same documents ending in -gr. Some examples of the files look like this:

English Language paths:

www.example.com/index.html
www.example.com/Blog.html

Greek Language path:

www.example.com/index-gr.html
www.example.com/Blog-gr.html

Is that possible to rename the greek files to something like the following example:

www.example.com/blog-gr.html/

should be renamed to

www.example.com/blog/gr

eg: Remove the -gr.html of all the greek documents and add /gr at the end. Also only for index file, example.com/index-gr.html should be example.com/gr Thanks

1条回答
走好不送
2楼-- · 2019-06-01 00:15

Try this

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)/gr$ greek/$1 [NC,L]

EDIT

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html/gr$ $1-gr.html [NC,L]
查看更多
登录 后发表回答