简体   繁体   中英

htaccess to redirect to another directory

i have the example website:

example.com

i have a blog folder on this website and i also have another folder with the exactly same files as the root(its a translated folder)

example.com/en/

I need to redirect users that click on my banner to the root blog folder, using the same atributes as he clicked.

for example:

he clicks on a blog post in the /en/ folder

example.com/en/blog/eventos_21_example-post

i need to add something on htaccess to redirect this link to

example.com/blog/eventos_21_example-post

It needs to be something that works for every post.

Any help?

Thank you

put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On
RewriteBase /

RewriteRule ^es/(blog/.*)$ /$1 [L,NC,R]
RewriteRule ^blog/(.*)$ /es/$1 [L,NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM