Enable mod_security only for specific directory

Current settings: – mod-security 2.9

Mod-security itself work as expected if enabled globally with SecRuleEngine on on main config but I need to enable it only for one specific folder for testing purpose.

so i try:

<Directory "/test_folder/test1/">  SecRuleEngine On </Directory> 

and

<LocationMatch "/test1/">  SecRuleEngine On </LocationMatch> 

both solution doesn’t work.

there are something that I miss or is not possible to enable it per directory?

Server 2016 Session time limits for specific users

I am aware you can set session time limits for all idle/disconnected users on Server 2012/2016 etc, however I was wondering if there is a way to end disconnected/idle session only for some users and not all? Reason being, we’d love to have the policy in place for most users however we need a single user to remain logged in and disconnected running an app in the background that is required, and thus cannot be affected by time limits.

How do I disable wpautop for a specific block?

I’ve registered a custom editor block with Advanced Custom Fields (ACF), and am using render_template with a PHP template partial to display the block contents.

Inside the template is some HTML (section with a figure and an a inside it). When the block is called and the template generates the HTML, it’s exactly as I author it, but when displayed on the front end, the a gets wrapped in a p tag, and a couple of br elements are added (I assume from wpautop()). This isn’t happening on the editor side, just on the front end, which leads me to believe the block HTML is getting run through the_content or some other filters that run wpautop() before display.

I’ve tried running the block content through buffering, which breaks the editor but fixes the front end, and tried disabling wpautop from running in the_content filter, but have had mixed results.

So my question is how to tell WordPress that I like my markup, thank you very much, and please leave it alone for this specific block?

Here’s a Gist of the block template: https://gist.github.com/morganestes/eca76cf8490f7b943d2f44c75674b648.

Google chrome not showing 1 specific page

A friend has a laptop and every time he tries going onto a page (asda groceries if anyone is curious) – if he is lucky it loads the logo and the black background of the nav bar, but that’s it but most of the time chrome throws the ERR_CONNECTION_CLOSED and refuses to load the page at all.

At one time, he managed to get it working by using system restore and then downloading chrome again but that worked twice for maybe 2 days and then he was back to this again. Changed his dns settings in windows to opendns and google dns which worked for 1 day, then back to this again. When he boots into safe mode with networking, it works fine. I have tried a lot of tuts suggesting fixes but none have worked.

His phone, my iphone, my S7 and my laptop all open the page fine, so it is something on his laptop. He has scanned for viruses/etc and is very aware and careful of what he downloads. I have looked through the running processes & services and there doesn’t look like there’s anything bad there.

Since it works in boot mode, there has to be something, but I am not sure where to go now.

Any suggestions as to what to try? Thanks

add_rewrite_tag broke permalinks that doesn’t use that specific tag

I have a custom post type that I’d like to have a permalink slug based on its taxonomy. All the posts of this CPT have one, and only one, term always marked on this specific taxonomy.
That’s my code:

function plugin_domain_register_post_type(){      add_rewrite_tag('%event_segment%', '([^&]+)');      register_post_type( 'event',         array(             'public' => true,             'rewrite' => array( 'slug' => '%event_segment%'),             'has_archive' => false,             'hierarchical' => false,             'supports' => array( 'title', 'thumbnail')         )     );  } add_action( 'init', 'plugin_domain_register_post_type' );  function plugin_domain_permalinks($  post_link, $  post) {     if (is_object($  post) && $  post->post_type === 'event') {         $  terms = wp_get_object_terms($  post->ID, 'segments');         if ($  terms) {             return str_replace('%event_segment%' , $  terms[0]->slug, $  post_link);         }     }     return $  post_link; } add_filter('post_type_link', 'plugin_domain_permalinks', 10, 3); 

Okay, so it actually works, the permalinks changed and it goes to the right post. However, all the posts and pages (everything that’s not of this CPT) that do not have the %event_segment% tag on the slug will literally just display the home page.

I’ve noticed this happens because of the add_rewrite_tag('%event_segment%', '([^&]+)'); part. The filter doesn’t seem to be the issue, since even without the rewrite tag, it works as intended, and modifies the permalinks.

I don’t know if this is relevant, but I’m on a Varying Vagrant Vagrants development environment, and it uses nginx, not apache.

What’s going on here? Is there something I did wrong or forgot to do?

Rewrite url for custom post type with specific url

I have a custom post types called Destinatiosn. These post on click opens as pages and they are organised hierarchically. Example:

  • Malaga

    • Food
    • Gallery
    • Rooms
  • Marbella

    • Food
    • Gallery
    • Rooms

Now in Rooms page, I am selecting to use other custom post types called “Room”. In this page I will show selected custom post types. But my problem is that when I click on these custom post types URL is changing. I just want to add on existing url only the name of the room.

Example, I am in this page:

/marbella/rooms 

On room custom post type click, I want room to be:

/marbella/rooms/room-name 

But when I click Url changed to:

/room/room-name 

function add_page_rewrite_rules(){ $ url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), '/'); $ wp_rewrite->add_permastruct( 'room', $ url_path . '/%room%', false ); }

But if I change url to something else working, when I am using example /malaga or /marbella it is not working and I don’t know why ?

How can I resolve my problem ?