Want to subscribe to topics you're interested in?
Become a Member

Wordpress set permalink ".html" wordpress.

Discussion in 'Blogs & CMS usage' started by congthanh, Jan 23, 2019.

  1. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    2:01 AM
    1.13
    I try to setup permalink "/%postname%.html" or "/%postname%.htm" but it doesnt work.
    i try to use "/%postname%.aspx". it works
    Thank you
    Regards
    • CentOS Version: CentOS Linux release 7.5.1804 (Core) 64Bit
    • Centmin Mod Version Installed: 123.08stable
    • Nginx Version Installed: 1.15.2
    • PHP Version Installed: PHP 5.6.38 (cli) (built: Oct 6 2018 12:19:43)

     
  2. eva2000

    eva2000 Administrator Staff Member

    44,702
    10,193
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,795
    Local Time:
    5:01 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Centmin Mod default static files include file at /usr/local/nginx/conf/staticfiles.conf handles .html files via Nginx. But by using wordpress with .html extensions you tell Nginx not to serve .html files and serve via PHP-FPM (not ideal as it reduces performance if you use permalinks with .html extensions and thus use PHP-FPM to server .html files)

    If you must use .html extension permalinks, you need to comment out the .html location context from /usr/local/nginx/conf/staticfiles.conf and restart Nginx server as illustrated below with hash # in front
    Code:
        location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
            gzip_static off;
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(js)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(css)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        #location ~* \.(html|htm|txt)$ {
            #add_header Pragma public;
            #add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            #access_log off;
            #expires 1d;
           # break;
           # }
    
        location ~* \.(eot|svg|ttf|woff)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
    You can also use SSH command shortcut below to launch nano linux text editor and edit file /usr/local/nginx/conf/staticfiles.conf
    Code:
    statfilesinc