Welcome Guest, Not a member yet? Register   Sign In
redirect from folder /en/ in controller /en/mycontroller
#1

[eluser]Unknown[/eluser]
Hi,

I am new to CI and to this forum. I was a C++ Programmer a long time ago.
Id like to create a multilang site but I want the controllers names translated too. (SEO)
www.test.com/en/in_english/in_english/
www.test.com/de/in_deutsch/in_deutsch/
www.test.com/fr/en_francais/en_francais/

To achieve this I started by creating 3 different controllers for each language of a site I wish to have.
IE
/de/Kontrollername
/fr/nomdecontroller
/en/controllername

Where /en/ /de/ and /fr/ are subdirectories of my root controllers folder.
I also work with a session, where I store the users language. Default is german.
My site will online have 3 sites which have to be translated, 3x3=9 controllers + 9 Views.

My problem now is that if the user tries to access www.test.com/de/ there is a 404 waiting for him.
I like to redirect him to www.test.com/de/in_deutsch then.
I tried it by putting a index.php to the /de/ /en/ folders but it hasnt changed anything.

I hope you can help me, and if I am totally wrong with this whole solution please tell.

Ben
#2

[eluser]mddd[/eluser]
Take a look at the 'routes' functionality. http://ellislab.com/codeigniter/user-gui...uting.html
You can make a route so that /de/ will be rerouted to /de/Kontrollername.
#3

[eluser]Unknown[/eluser]
Thanks!
I understand.
I would only want a route to the controller applied when there is only http://localhost/de/ in the url.
But I dont know how to write such a regex Sad




Theme © iAndrew 2016 - Forum software by © MyBB