VPSMATE

  • HOME
  • NEWS
  • VPS
  • DEDICATED
  • ARCHIVES
  • GoDaddy
  • SCRIPT
  • TOOLS
    • Traceroute
    • Benchmark
    • Useful Sites
  • Themes
  • GFW
VPSMATE
VPS COUPON & PROMOS | VPS & DEDICATED SERVERS OFFERS | VPS REVIEWS
  1. Home
  2. Tips
  3. This article

Webuzo - Nginx rewrite rule for Wordpress

16/09/2014 8413Browse 0Like 0Comments

People find unable to get permalink work in Wordpress when use Nginx stack. It's because Nginx rewrite rule for Wordpress has been set up.

Follow the instruction below to get this done.

At the beginning, I thought the following method was alright till I found out it was generated by Webuzo and gets overwritten by Webuzo every time you make site configuration change.

nano /usr/local/apps/nginx/etc/conf.d/webuzoVH.conf

Add:

if (!-e $request_filename)
{
    rewrite ^(.+)$ /index.php?q=$1 last;
}

make it look like:

server {
        listen          80;
        server_name     yoursite.com www.yoursite.com;
        # The Document Root
        root            /home/admin/www/yoursite.com;
        error_log       /usr/local/apps/nginx/var/log/yoursite.com.err;
        access_log      /usr/local/apps/nginx/var/log/yoursite.com.log main;
        include         /usr/local/apps/nginx/etc/conf.d/common;
        if (!-e $request_filename)
        {
            rewrite ^(.+)$ /index.php?q=$1 last;
        }
}

restart nginx

service nginx restart

So, let add the rewrite in /usr/local/apps/nginx/etc/conf.d/common

add the following to the file:

#For wordpress
if (!-e $request_filename)
{
    rewrite ^(.+)$ /index.php?q=$1 last;
}

Then, restart nginx

service nginx restart

 

 

Related

Tags: None
Last updated:16/09/2014

kyaky

The man was lazy and left nothing behind

Like
< Previous
Next >

Comments

Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

COPYRIGHT © 2021 vpsmate.net. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS