Learn about Centmin Mod LEMP Stack today
Register Now

Nginxn redirect page

Discussion in 'Install & Upgrades or Pre-Install Questions' started by EckyBrazzz, Jun 1, 2019.

Tags:
  1. EckyBrazzz

    EckyBrazzz Active Member

    772
    153
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +282
    Local Time:
    4:42 AM
    1.17.x Cluster
    10.3.x Cluster & Redis
    I need to redirect a page that is created from my theme. I already open tickets at several support teams, but they couldn't figure it out, so thought, he, we use the power full Nginx and rewrite rules.

    But when using these I get 404 not found. I cleaned the cache, did a save on permlinks but no go.
    Example below
    Code (Text):
      #include /usr/local/nginx/conf/wpincludes/domain.com/rediscache_domain.com.conf;
      # if using the ultimate badbot blocker guide after testing
      # https://community.centminmod.com/threads/nginx-ultimate-bad-block-blocker.14413/
      include /usr/local/nginx/conf/ultimate-badbot-blocker/bots.d/ddos.conf;
      include /usr/local/nginx/conf/ultimate-badbot-blocker/bots.d/blockbots.conf;
    
    
    #location = /coupons {
    #  return 301 /bedrijven;
    #}
    
    #location ~ ^/coupons/(.*) {
    #     rewrite ^ https://domain.com/bedrijven/$1;
    #}
    
    # Custom Redirects
    #    rewrite ^/coupons$ /bedrijven permanent;
    
    location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    

     
  2. EckyBrazzz

    EckyBrazzz Active Member

    772
    153
    43
    Mar 28, 2018
    >>>>Click here<<<< i'm nearby......
    Ratings:
    +282
    Local Time:
    4:42 AM
    1.17.x Cluster
    10.3.x Cluster & Redis
    Fixed all issues in child them
    Code (Text):
    function mts_child_init() {
        $args = get_taxonomy('mts_coupon_categories');
        $args->rewrite['slug'] = 'bedrijven_cat';
        register_taxonomy($args->name, 'coupons', $args);
        $args = get_taxonomy('mts_coupon_tag');
        $args->rewrite['slug'] = 'bedrijven_tag';
        register_taxonomy($args->name, 'coupons', $args);
    }
    add_action( 'init', 'mts_child_init', 11 );
    
    // Change Coupons slug
    add_filter('register_post_type_args', 'change_coupons_cpt_slug', 10, 2);
    function coupons_cpt_slug($args, $post_type){
        if ($post_type == 'coupons'){
            $args['rewrite']['slug'] = 'bedrijven';
        }
        return $args;
    }
    //End Change Coupons slug
    
     
    • Informative Informative x 1