0

I am a newbie for Laravel framework.

I am trying out a simple URL "http://localhost/test?code=value" and when trying to access the value of code in controller like $_GET["code"] or Input::get('code'), I could not access the value in my controller.

I am using digitalocean server with nginx server.

Here is .htaccess file in my project

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

When i tried with simple php script in test.php file <?php print_r($_GET); ?> I can access the values. So, I believe there is no problem with my server settings.

I tried the answer mentioned for similar issue Laravel stripping $_GET parameters but it didnt work for me.

Any help will be appreciated. I am stuck for long time :(

Community
  • 1
  • 1
Saravanan S
  • 1,021
  • 1
  • 10
  • 24

1 Answers1

0

Finally solved this issue. There was a mis-configuration in nginx server. In /etc/nginx/sites-available/default, instead of having below configuration try_files $uri $uri/ /index.php?$query_string;, it was try_files $uri $uri/ /index.php$query_string; without a ?. After adding ? everything became normal.

Saravanan S
  • 1,021
  • 1
  • 10
  • 24