Created
April 16, 2013 19:46
-
-
Save j-mcnally/5398993 to your computer and use it in GitHub Desktop.
Wordpress & Codeigniter NGINX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| index index.php index.html index.htm; | |
| # enforce www (exclude certain subdomains) | |
| #if ($host !~* ^(www|subdomain)) | |
| #{ | |
| # rewrite ^/(.*)$ $scheme://www.$host/$1 permanent; | |
| #} | |
| # enforce NO www | |
| #if ($host ~* ^www\.(.*)) | |
| #{ | |
| # set $host_without_www $1; | |
| # rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent; | |
| #} | |
| # canonicalize codeigniter url end points | |
| # if your default controller is something other than "welcome" you should change the following | |
| if ($request_uri ~* ^(/pg(/index)?|/index(.php)?)/?$) | |
| { | |
| rewrite ^(.*)$ / permanent; | |
| } | |
| # removes trailing "index" from all controllers | |
| if ($request_uri ~* index/?$) | |
| { | |
| rewrite ^/(.*)/index/?$ /$1 permanent; | |
| } | |
| # removes trailing slashes (prevents SEO duplicate content issues) | |
| if (!-d $request_filename) | |
| { | |
| rewrite ^/(.+)/$ /$1 permanent; | |
| } | |
| # removes access to "system" folder, also allows a "System.php" controller | |
| if ($request_uri ~* ^/system) | |
| { | |
| rewrite ^/(.*)$ /index.php?/$1 last; | |
| break; | |
| } | |
| # 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; | |
| } | |
| # catch all | |
| error_page 404 /index.php; | |
| # deny access to apache .htaccess files | |
| location ~ /\.ht | |
| { | |
| deny all; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| location / { | |
| try_files $uri $uri/ /index.php?q=$uri&$args; | |
| } | |
| rewrite ^.*/files/(.*) /wp-includes/ms-files.php?file=$1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment