S
S
Stas2018-05-11 18:03:25
PHP
Stas, 2018-05-11 18:03:25

Is it possible to use github as hosting for landing pages with PHP scripts?

Hello.
There is such a task. Make a landing page that would determine the browser language and substitute the desired text or redirect to the desired page. As here, when changing the browser language, a different page text is displayed https://www.fuckbook.tv/index-survey?version=1
Such a trick can be implemented via php as I know. There is even a good description: https://habr.com/post/159129/
But there is one thing. The hosting is github. And now the question arises, will it even work on github?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Arkhipov, 2018-05-11
@ColliderBang

No, GitHub Pages is designed to host static files only, executable files are not supported on the server.
However, you can also determine the browser language and make a redirect using javascript.

<script>
var userLang = navigator.language || navigator.userLanguage; 
alert ("The language is: " + userLang);
if (userLang === "ru-RU"){
window.location.href="https://google.com/";
}
</script>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question