/    Sign up×
Community /Pin to ProfileBookmark

Index redirect within same folder

Hi,

Let’s say I have a multilingual website structured via the .htaccess file to lead visitors to the index page according to their browsers language settings.

There could be three different index files in three different languages like:

index.en.php = English
index.es.php = Spanish
index.fr.php = French

Well, so far so good.

My question goes like this:

What technology would you recommend to facilitate the option of switching language within a directory?

Say like the visitor lands on the English version of the page because his browser settings are English, but he would like to see the Spanish language version of the page – without changing browser language settings.

to post a comment
Full-stack Developer

2 Comments(s)

Copy linkTweet thisAlerts:
@Stephen_PhilbinJun 16.2005 — I don't think you could really. I mean if you've set it to force people to go to a certain bage depending on info sent by the browser, then then there's nothing your pages can do. The user will just keep getting forced to the same pages as far as I know.

I think the best way would brobably be to have the user be sent to a language select page first and then set a session or a cookie reflecting the users choice of language from that page and use that as the basis of a php redirect system in your documents themselves.
Copy linkTweet thisAlerts:
@ray326Jun 17.2005 — You could set a cookie based on the initial browser setting then alter the content of that cookie with Javascript or a server side language.
×

Success!

Help @philaweb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...