N
N
Nazar Linovetsky2015-12-16 23:11:31
Apache HTTP Server
Nazar Linovetsky, 2015-12-16 23:11:31

Redirect from root to internal directory in Apache?

I am making a multilingual site. At the same time, I store different versions of index pages in separate directories:
1. mysite.com/en/index.php - English index
2. mysite.com/en/index.php - Russian index
How to properly redirect a user who is trying to request a path: mysite .com to mysite.com/en/index.php ??? What to write in .htaccess ?
... and an additional question: What else needs to be considered in this case?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nazar Linovetsky, 2015-12-17
@forbestweb

Found how to do it

RewriteEngine On
RewriteRule ^$ /newdir [L]

O
OnYourLips, 2015-12-17
@OnYourLips

At the same time, I store different versions of index pages in separate directories.
This is bad, there should be only one entry point.
Then everything becomes simple, and routing will be just part of the application code.
And you won't need to bind to Apache.

E
Evgeny Svirsky, 2015-12-17
@e_svirsky

Agree with OnYourLips . Before it's too late - change the architecture. Because it will get worse. There is only one entry point, one file, and according to routing - we define locale and draw a page with the necessary translation. Imagine you will have 5 languages, and you will need to change the picture or index.php structure, you will have to climb into all locales and change all files. It's a very crooked architecture. And if done correctly, you can simply set the default locale in the config (for example, ru), or even determine it automatically by the user's ip, for example, and you will not need to bind to Apache. The fewer connections the better, trust me.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question