I am currently working on a website that is available in multiple languages. I put some effort in atomatically detecting the users preferred language. This itself is working great. I also offer language buttons to change the language of the site. The URL does not change. I save the language settings with a PHP session. This is working great! But Google just sees the default language (which is English). This is because the buttons for changing the language are inside a form wich sends a POST request.
To summarize it my site does not change the URL when changing the language. My idea to tell Google that it has several different languages is using
hreflang tags which will point to the current page but the domain gets a subsdomain with the current language.
<link rel="alternate" hreflang="en" href="http://en.example.com/"> <link rel="alternate" hreflang="de" href="http://de.example.com/">
http://de.example.com/ these sites redirect back to
http://example.com/ to make sure the URL stays the same.
Will Google properly index my pages when I do this?