0

On my localhost when I use php <?php echo var_dump($_GET); ?> I get this array(1) { ["lng"]=> string(3) "eng" } But on server I get this array(0) { }.

Everything is exactly the same as on localhost.

<?php
if(!isset($_GET["lng"])) { ?>
<li class="language"><i class="fa fa-flag" aria-hidden="true"></i><a href="index.php?lng=eng"> English</a></li>
<?php }
else if($_GET["lng"] == "eng") { ?>
<li class="language"><i class="fa fa-flag" aria-hidden="true"></i><a href="index.php?lng=srb"> Srpski</a></li>
<?php }
else if($_GET["lng"] == "srb") { ?>
<li class="language"><i class="fa fa-flag" aria-hidden="true"></i><a href="index.php?lng=eng"> English</a></li>
<?php } ?>
Muhammad Ali Hassan
  • 960
  • 2
  • 12
  • 29
Kosta
  • 37
  • 6
  • did you passed the get parameter on your server? – A l w a y s S u n n y Jul 03 '18 at 17:27
  • what is your url, is querystring is there in url – Muhammad Ali Hassan Jul 03 '18 at 17:29
  • url is http://www.myserver.rs/?lng=eng – Kosta Jul 03 '18 at 17:37
  • What happens if you paste the URL into the browser? Try it with other URL parameters (e.g., `?lng=eng&test=yes&whoami=Kosta`) to see if your `lng` parameter is being filtered out by your Apache config (or .htaccess file). – Mr Glass Jul 03 '18 at 17:48
  • is `lse if($_GET["lng"] == "srb") {` a typo (missing e) – Nigel Ren Jul 03 '18 at 17:50
  • @MrGlass Thans i fix my problem.I open my `.httaccess` file and i remove `Options -indexes` .Now working but i have another problem when i go to mysite `www.mysite.com` i redirect to page `Indexed of` and i need to click MySite to load site... – Kosta Jul 03 '18 at 17:58
  • If you add `DirectoryIndex name-of-your-file.ext` to your htaccess file it should load the page you want. – Mr Glass Jul 03 '18 at 18:02
  • Still problem... my .httaccess file: # BEGIN WordPress ` RewriteEngine On RewriteBase /MySite/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /MySite/index.php [L] # END WordPress DirectoryIndex index.php` – Kosta Jul 03 '18 at 18:19
  • Fixed just add FolderName/index.php – Kosta Jul 03 '18 at 18:42

0 Answers0