Title: permalink problem on nginx
Last modified: August 20, 2016

---

# permalink problem on nginx

 *  Resolved [ShinichiN](https://wordpress.org/support/users/shinichin/)
 * (@shinichin)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/permalink-problem-on-nginx/)
 * I read [Codex > Nginx](http://codex.wordpress.org/Nginx) and succeeded to have
   network install (subdirectory).
 * But I have two problems with permalink settings ( [http://example.com/wp-admin/options-permalink.php](http://example.com/wp-admin/options-permalink.php)).
 * First, I see a slug `/blog` **before** input area.
    Second, there is a slug `/
   index.php/` in the input area.
 * Please see [screenshot](http://nskw-style.com/wordpress/wp-content/uploads/2011/08/link-blog.png).
 * I can’t get rid of either of them.
    (`/blog` is uneditable, and `/index.php/`
   appears every time even I submit without `/index.php/`…:( )
 * I have these problems only at the main (blog id = 1) site.
 * Please if you know how to fix it, please let me know.
 * Here is my nginx config files.
 * nginx.conf:
 *     ```
       user              nginx;
       worker_processes  2;
       error_log  /var/log/nginx/error.log;
       pid        /var/run/nginx.pid;
   
       events {
           worker_connections  1024;
       }
   
       http {
       	include	/etc/nginx/mime.types;
       	default_type 	application/octet-stream;
       	access_log	/var/log/nginx/access.log;
       	sendfile        on;
       	#tcp_nopush     on;
       	keepalive_timeout  3;
       	#tcp_nodelay	on;
       	gzip  on;
       	#client_max_body_size 13m;
       	index      index.php index.html index.htm;
       	log_not_found off;
   
       #	Upstream to abstract backend connection(s) for PHP.
       #	upstream php {
       #		server unix:/tmp/php-fpm.sock;
       #		server 127.0.0.1:9000;
       #	}
   
       	include		sites-enabled/*;
   
       	server {
       	listen       80;
       	server_name  example.com;
       	root /var/www/vhosts/example.com;
   
       	if ($http_host != "example.com") {
       		rewrite ^ http://example.com$request_uri permanent;
       	}
   
       	include global/restrictions.conf;
       	include global/wordpress-ms-subdir.conf;
       	access_log /var/log/nginx/colog.jp.access.log;
   
       	}# end server{}
   
       }# end http {}
       ```
   
 * global/wordpress-ms-subdir.conf:
 *     ```
       # This order might seem weird - this is attempted to match last if rules below fail.
       # http://wiki.nginx.org/HttpCoreModule
       location / {
       	try_files $uri $uri/ /index.php?$args;
       }
   
       # http://j.mp/ni5J6W
       ##necessary if using a multi-site plugin
       server_name_in_redirect off;
       ##necessary if running Nginx behind a reverse-proxy
       #port_in_redirect off;
   
       # Add trailing slash to */wp-admin requests.
       rewrite /wp-admin$ $scheme://$host$uri/ permanent;
   
       # Directives to send expires headers and turn off 404 error logging.
       location ~ .*\.(txt|xml|html?|jpe?g|JPE?G|gif|GIF|png|PNG|swf|SWF|wmv|WMV|flv|FLV|css|CSS|js|JS|inc|ico|gz) {
       	expires 24h;
       	log_not_found off;
       	break;
       }
   
       # Pass uploaded files to wp-includes/ms-files.php.
       rewrite /files/$ /index.php last;
   
       # For multisite:  Use a caching plugin that creates symlinks to the correct subdirectory structure to get some performance gains.
       set $cachetest "$document_root/wp-content/cache/ms-filemap/${host}${uri}";
       if ($uri ~ /$) {
       	set $cachetest "";
       }
       if (-f $cachetest) {
       	# Rewrites the URI and stops rewrite processing so it doesn't start over and attempt to pass it to the next rule.
       	rewrite ^ /wp-content/cache/ms-filemap/${host}${uri} break;
       }
   
       if ($uri !~ wp-content/plugins) {
       	rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
       }
   
       # Uncomment one of the lines below for the appropriate caching plugin (if used).
       #include global/wordpress-ms-subdir-wp-super-cache.conf;
       #include global/wordpress-ms-subdir-w3-total-cache.conf;
   
       # Rewrite multisite '.../wp-.*' and '.../*.php'.
       if (!-e $request_filename) {
       	rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
       	rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
       	rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
       	rewrite ^.*$ /index.php last;
       }
       # Pass all .php files onto a php-fpm/php-fcgi server.
       location ~ \.php$ {
       	root 			html;
       	fastcgi_pass	127.0.0.1:9000;
       	fastcgi_index	index.php;
       	fastcgi_param	SCRIPT_FILENAME /var/www/vhosts/colog.jp$fastcgi_script_name;
       	include			fastcgi_params;
       }
       ```
   
 * Thanks.

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/permalink-problem-on-nginx/?output_format=md)
[1](https://wordpress.org/support/topic/permalink-problem-on-nginx/?output_format=md)
2

 *  [harrymfa](https://wordpress.org/support/users/harrymfa/)
 * (@harrymfa)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/permalink-problem-on-nginx/page/2/#post-2251949)
 * Defining ‘MULTISITE’, false in the wp-config.php file fixed it for me.

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/permalink-problem-on-nginx/?output_format=md)
[1](https://wordpress.org/support/topic/permalink-problem-on-nginx/?output_format=md)
2

The topic ‘permalink problem on nginx’ is closed to new replies.

## Tags

 * [nginx](https://wordpress.org/support/topic-tag/nginx/)
 * [permalink](https://wordpress.org/support/topic-tag/permalink/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 16 replies
 * 6 participants
 * Last reply from: [harrymfa](https://wordpress.org/support/users/harrymfa/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/permalink-problem-on-nginx/page/2/#post-2251949)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
