• After updating the permalinks on my system are broken. Standard permalink works fine. The post permalink redirects me back to homepage. This is after update.

    My system uses nginx on ajenti v.

    Does someone knows a solution?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Did you save the permalink setting, and issue still exists? BTW did you restarted nginx service after the update?

    • This reply was modified 9 years, 8 months ago by M Asif Rahman. Reason: spelling

    To add to what Asif was saying simply go into the Settings >>> Permalinks keep the settings the same and hit the save button.

    Thread Starter venigo

    (@venigo)

    I resaved the permalink settings indeed. Updated the nginx conf of wt3c.. Then ‘ngibx -t’ no errors, then restarted… I turned on the standard permalink settings.. Everything on post settings redirects to root url…

    As it seems could be hard to debug, if you are familiar with server and debugging, do that or my suggestion will be, uninstall the plugin, delete completely, then install and setup again, turn on each type of caching after testing.

    Thread Starter venigo

    (@venigo)

    location ^~ /.well-known/acme-challenge/ {
    alias /var/www/letsencrypt.sh/;
      allow all;
      #deny all;
    }
    
    # This order might seem weird - this is attempted to match last if rules below fail.
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    
    # 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 ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
           access_log off; log_not_found off; expires max;
    }
    
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
    location ~ /\.(htaccess|htpasswd|DS_Store) {
        deny all;
    }
    
    location ~ /\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
               add_header Access-Control-Allow-Origin "*";
    }
    
    location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public";
    }
    
        ## Block SQL injections
        set $block_sql_injections 0;
        if ($query_string ~ "union.*select.*\(") {
            set $block_sql_injections 1;
        }
        if ($query_string ~ "union.*all.*select.*") {
            set $block_sql_injections 1;
        }
        if ($query_string ~ "concat.*\(") {
            set $block_sql_injections 1;
        }
        if ($block_sql_injections = 1) {
            return 403;
        }
    
        ## Block file injections
        set $block_file_injections 0;
        if ($query_string ~ "[a-zA-Z0-9_]=http://") {
            set $block_file_injections 1;
        }
        if ($query_string ~ "[a-zA-Z0-9_]=(\.\.//?)+") {
            set $block_file_injections 1;
        }
        if ($query_string ~ "[a-zA-Z0-9_]=/([a-z0-9_.]//?)+") {
            set $block_file_injections 1;
        }
        if ($block_file_injections = 1) {
            return 403;
        }
    
        ## Block common exploits
        set $block_common_exploits 0;
        if ($query_string ~ "(<|%3C).*script.*(>|%3E)") {
            set $block_common_exploits 1;
        }
        if ($query_string ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
            set $block_common_exploits 1;
        }
        if ($query_string ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
            set $block_common_exploits 1;
        }
        if ($query_string ~ "proc/self/environ") {
            set $block_common_exploits 1;
        }
        if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)") {
            set $block_common_exploits 1;
        }
        if ($query_string ~ "base64_(en|de)code\(.*\)") {
            set $block_common_exploits 1;
        }
        if ($block_common_exploits = 1) {
            return 403;
        }
    
        ## Block spam
        set $block_spam 0;
        if ($query_string ~ "\b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b") {
            set $block_spam 1;
        }
        if ($query_string ~ "\b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b") {
            set $block_spam 1;
        }
        if ($query_string ~ "\b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b") {
            set $block_spam 1;
        }
        if ($query_string ~ "\b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b") {
            set $block_spam 1;
        }
        if ($block_spam = 1) {
            return 403;
        }
    
        ## Block user agents
        set $block_user_agents 0;
    
        # Don't disable wget if you need it to run cron jobs!
        #if ($http_user_agent ~ "Wget") {
        #    set $block_user_agents 1;
        #}
    
        # Disable Akeeba Remote Control 2.5 and earlier
        if ($http_user_agent ~ "Indy Library") {
            set $block_user_agents 1;
        }
    
        # Common bandwidth hoggers and hacking tools.
        if ($http_user_agent ~ "libwww-perl") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "GetRight") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "GetWeb!") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "Go!Zilla") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "Download Demon") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "Go-Ahead-Got-It") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "TurnitinBot") {
            set $block_user_agents 1;
        }
        if ($http_user_agent ~ "GrabNet") {
            set $block_user_agents 1;
        }
    
        if ($block_user_agents = 1) {
            return 403;
        }
    
    # BEGIN W3TC Minify cache
    location ~ /content/cache/minify.*\.js$ {
        types {}
        default_type application/x-javascript;
        expires modified 31536000s;
        add_header X-Powered-By "W3 Total Cache/0.9.5";
        add_header Vary "Accept-Encoding";
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public";
    }
    location ~ /content/cache/minify.*\.css$ {
        types {}
        default_type text/css;
        expires modified 31536000s;
        add_header X-Powered-By "W3 Total Cache/0.9.5";
        add_header Vary "Accept-Encoding";
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public";
    }
    location ~ /content/cache/minify.*js\.gzip$ {
        gzip off;
        types {}
        default_type application/x-javascript;
        expires modified 31536000s;
        add_header X-Powered-By "W3 Total Cache/0.9.5";
        add_header Vary "Accept-Encoding";
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public";
        add_header Content-Encoding gzip;
    }
    location ~ /content/cache/minify.*css\.gzip$ {
        gzip off;
        types {}
        default_type text/css;
        expires modified 31536000s;
        add_header X-Powered-By "W3 Total Cache/0.9.5";
        add_header Vary "Accept-Encoding";
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public";
        add_header Content-Encoding gzip;
    }
    # END W3TC Minify cache
    # BEGIN W3TC Minify core
    set $w3tc_enc "";
    if ($http_accept_encoding ~ gzip) {
        set $w3tc_enc .gzip;
    }
    if (-f $request_filename$w3tc_enc) {
        rewrite (.*) $1$w3tc_enc break;
    }
    rewrite ^/content/cache/minify/ /index.php last;
    # END W3TC Minify core
    # BEGIN W3TC Page Cache core
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
        set $w3tc_rewrite 0;
    }
    if ($query_string != "") {
        set $w3tc_rewrite 0;
    }
    if ($request_uri !~ \/$) {
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {
        set $w3tc_rewrite 0;
    }
    if ($http_user_agent ~* "(W3\ Total\ Cache)") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_ua "";
    if ($http_user_agent ~* "(240x320|2\.0\ mmp|\bppc\b|alcatel|amoi|asus|au\-mic|audiovox|avantgo|benq|bird|blackberry|blazer|cdm|cellphone|danger|ddipocket|docomo|dopod|elaine/3\.0|ericsson|eudoraweb|fly|haier|hiptop|hp\.ipaq|htc|huawei|i\-mobile|iemobile|iemobile/7|iemobile/9|j\-phone|kddi|konka|kwc|kyocera/wx310k|lenovo|lg|lg/u990|lge\ vx|midp|midp\-2\.0|mmef20|mmp|mobilephone|mot\-v|motorola|msie\ 10\.0|netfront|newgen|newt|nintendo\ ds|nintendo\ wii|nitro|nokia|novarra|o2|openweb|opera\ mobi|opera\.mobi|p160u|palm|panasonic|pantech|pdxgw|pg|philips|phone|playbook|playstation\ portable|portalmmm|proxinet|psp|qtek|sagem|samsung|sanyo|sch|sch\-i800|sec|sendo|sgh|sharp|sharp\-tq\-gx10|small|smartphone|softbank|sonyericsson|sph|symbian|symbian\ os|symbianos|toshiba|treo|ts21i\-10|up\.browser|up\.link|uts|vertu|vodafone|wap|willcome|windows\ ce|windows\.ce|winwap|xda|xoom|zte)") {
        set $w3tc_ua _low;
    }
    if ($http_user_agent ~* "(acer\ s100|android|archos5|bada|bb10|blackberry9500|blackberry9530|blackberry9550|blackberry\ 9800|cupcake|docomo\ ht\-03a|dream|froyo|googlebot-mobile|htc\ hero|htc\ magic|htc_dream|htc_magic|iemobile/7.0|incognito|ipad|iphone|ipod|kindle|lg\-gw620|liquid\ build|maemo|mot\-mb200|mot\-mb300|nexus\ 7|nexus\ one|opera\ mini|s8000|samsung\-s8000|series60.*webkit|series60/5\.0|sonyericssone10|sonyericssonu20|sonyericssonx10|t\-mobile\ mytouch\ 3g|t\-mobile\ opal|tattoo|touch|webmate|webos)") {
        set $w3tc_ua _high;
    }
    set $w3tc_preview "";
    if ($http_cookie ~* "(w3tc_preview)") {
        set $w3tc_preview _preview;
    }
    set $w3tc_ssl "";
    if ($scheme = https) {
        set $w3tc_ssl _ssl;
    }
    set $w3tc_enc "";
    if ($http_accept_encoding ~ gzip) {
        set $w3tc_enc _gzip;
    }
    if (!-f "$document_root/content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ua$w3tc_ssl$w3tc_preview.html$w3tc_enc") {
      set $w3tc_rewrite 0;
    }
    if ($w3tc_rewrite = 1) {
        rewrite .* "/content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_ua$w3tc_ssl$w3tc_preview.html$w3tc_enc" last;
    }
    # END W3TC Page Cache core
    # BEGIN W3TC Page Cache cache
    location ~ /content/cache/page_enhanced.*html$ {
        expires modified 3600s;
        add_header X-Powered-By "W3 Total Cache/0.9.5";
        add_header Vary "Accept-Encoding, Cookie";
        add_header Pragma "public";
        add_header Cache-Control "max-age=3600, public";
    }
    location ~ /content/cache/page_enhanced.*gzip$ {
        gzip off;
        types {}
        default_type text/html;
        expires modified 3600s;
        add_header X-Powered-By "W3 Total Cache/0.9.5";
        add_header Vary "Accept-Encoding, Cookie";
        add_header Pragma "public";
        add_header Cache-Control "max-age=3600, public";
        add_header Content-Encoding gzip;
    }
    # END W3TC Page Cache cache
    # BEGIN W3TC Browser Cache
    gzip on;
    gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
    location ~ (robots\.txt|[a-z0-9_\-]*sitemap[a-z0-9_\-]*\.(xml|xsl|html)(\.gz)?|([a-z]+)?-?sitemap.xsl|([a-z]+)?-?sitemap_index.xml) {
        try_files $uri $uri/ $uri.html /index.php?$args;
    }
    location ~ \.(css|htc|less|js|js2|js3|js4)$ {
        expires 31536000s;
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public";
        add_header X-Powered-By "W3 Total Cache/0.9.5";
    }
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd)$ {
        expires 3600s;
        add_header Pragma "public";
        add_header Cache-Control "max-age=3600, public";
        add_header X-Powered-By "W3 Total Cache/0.9.5";
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip)$ {
        expires 31536000s;
        add_header Pragma "public";
        add_header Cache-Control "max-age=31536000, public";
        add_header X-Powered-By "W3 Total Cache/0.9.5";
    }
    # END W3TC Browser Cache

    This is my current nginx conf.. I will try with reinstalling wt3c

    Thread Starter venigo

    (@venigo)

    After clean up, permalinks still broken.. Other wp sites on my vps are working correct with same config on nginx… Really wtf

    location ^~ /.well-known/acme-challenge/ {
    alias /var/www/letsencrypt.sh/;
      allow all;
      #deny all;
    }
    
    location / {
            try_files $uri $uri/ /index.php?$args;
    }
    
    # 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 ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
           access_log off; log_not_found off; expires max;
    }
    
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
    # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
    location ~ /\. {
        deny all;
    }
    # Deny access to any files with a .php extension in the uploads directory
    # Works in sub-directory installs and also in multisite network
    # Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
    location ~* /(?:uploads|files)/.*\.php$ {
        deny all;
    }
    Thread Starter venigo

    (@venigo)

    Next thing I get with debug this:

    No rules defined.
    Debug This Mode: rewrites – A list of all cached rewrites. To refresh the cache, visit Settings->Permalinks

    Current Rewrite

    Matched Rule:
    Matched Query:
    Query String: debug-this=rewrites

    Rewrite Rules

    Do you have a list of the plugins there might be a plugin conflict?

    Thread Starter venigo

    (@venigo)

    All plugins disabled..

    Switched the theme to a default one… Works..
    Switched back to my custom the.. Works..

    Seems to be a old template cache in the databases?

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Permalinks broken’ is closed to new replies.