Reputation: 97
I want my apache .htaccess to work with nginx.
I've got this .htaccess file/code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I hope you can help me :)
Upvotes: 0
Views: 105
Reputation: 249
if you want to keep the "index.php" in the url, I would do
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri @redirect;
...
}
location @redirect {
return 301 $1/index.php;
}
Upvotes: 0
Reputation: 2642
It will transform to something of this kind with nginx :
server {
server www.domain.com;
index index.php;
location / {
try_files $uri $uri/ /index.php;
}
location ~\.php$ {
...
}
}
Upvotes: 1