Skip to content

Instantly share code, notes, and snippets.

@lambdacpp
Created August 30, 2015 02:28
Show Gist options
  • Select an option

  • Save lambdacpp/b91449b367d55bcacde2 to your computer and use it in GitHub Desktop.

Select an option

Save lambdacpp/b91449b367d55bcacde2 to your computer and use it in GitHub Desktop.
nginx_htaccess
# removes trailing slashes (prevents SEO duplicate content issues)
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment