-1

I need to set up my Larave project inside another PHP project to access that project using https://example.com/laravel-project

Because I need to use the same domain for the new Laravel project.

For that, I used apache VirtualHost configuration like below,

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot "C:/Wamp/vhosts/example"

    Alias /laravel-project "C:/Wamp/vhosts/example/blog/laravel-project/public"

    <Directory "C:/Wamp/vhosts/example">        
        allow from all
        order allow,deny
        AllowOverride All
    </Directory>
</VirtualHost>

Now routes are working fine but query strings not working well. seems every url missing query strings.

https://example.com/laravel-project?test=value

But Laravel App didn't identify test query parameter.

How can I fix this problem?

Gayan
  • 14
  • 3
  • Can you give a sample code that fails to get the query string parameters? – dparoli Sep 05 '19 at 06:54
  • @dparoli `$test = $request->query('test');` this is the sample method I used – Gayan Sep 05 '19 at 08:09
  • Please read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) so that someone can understand what you are asking. Also take a look at [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) to improve your chances of getting an answer. Then, please update your question. – dparoli Sep 05 '19 at 08:12
  • thank you @dparoli, I just solved *query string missing* issue. I was wrong about VirtualHost configuration. But the issue was in *.htaccess* configurations. I add my solution below – Gayan Sep 05 '19 at 10:53

1 Answers1

0

The issue was not in VirtualHost configuration, It's in .htaccess file configurations. Updating RewriteRule with [QSA] flag, solved query string missing issue.

RewriteRule ^ index.php?$1 [L, QSA]

Gayan
  • 14
  • 3