Allan Hansen
Allan Hansen

Reputation: 106

convert Apache to Nginx

How will it look like in /etc/nginx/sites-available/default? I use nginx/1.6.0

<Directory "c:/wamp/www/ProjectName">
  RewriteEngine on 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
</Directory>

I've tried:

 location /ProjectName {
    try_files $uri $uri/ /ProjectName/index.php?r=$request_uri;
     }

It almost seems to work but if I have are url with questions mark: http://ProjectName.dk/Test/site/getPerson?Id=369 I get error?

The question is what else should be added to the nginx conf?

Upvotes: 3

Views: 94

Answers (1)

Allan Hansen
Allan Hansen

Reputation: 106

Found the solution:

try_files $uri $uri/ /ProjectName/index.php?r=$query_string;

Now it works with questions mark.

Upvotes: 1

Related Questions