Reputation: 151
I just transferred my website from GoDaddy (Apache) to DigitalOcean (Nginx/LEMP). The Web site was developed using PHP/CodeIgniter. I am only able to see the first page (index.php). It works if I provide the full URL of any file, but I cannot access URL rewrites. Looks like some issue with my .htaccess file...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Any help or link/tutorial on how to move from Apache to Nginx will be helpful.
Upvotes: 1
Views: 1867
Reputation: 151
I figured it out.
Your whole rewrite rule converted to one line
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
to
location / {
try_files $uri $uri/ /index.php?$args;
}
The update/edit your default nginx file by
nano /etc/nginx/sites-available/default
and restart the service
sudo nginx service restart
Thanks for thos who looked and replied.
Upvotes: 2