Support » Plugin: All In One WP Security & Firewall » Custom rules in the beginning oh .htaccess file
Custom rules in the beginning oh .htaccess file
-
It would be very interesting if in the Custom Rules section of the plugin, we have a checkbox with the feature “Put this rules in the beginning of .htaccess file”.
-
Hi, thank you for your suggestion. The plugin developers will investigate further your request.
Regards
Hi @aldemarcalazans,
Sounds like a reasonable suggestion. I will look into this as a possible feature to be added in a future release soon.Hi. I implemented in my edited version of your plugin this feature with success, as follow:
wp-security-firewall-menu.php
`$aio_wp_security->configs->set_value(‘aiowps_enable_custom_rules’,isset($_POST[“aiowps_enable_custom_rules”])?’1′:”);
//add an option to place custom rules at the beginning of .htaccess (1 of to 2)
// +++++ start of added code +++++ $aio_wp_security->configs->set_value(‘aiowps_place_custom_rules_at_the_beginning’,isset($_POST[“aiowps_place_custom_rules_at_the_beginning”])?’1′:”);
// +++++ end of added code +++++
$aio_wp_security->configs->save_config(); //Save the configuration(…)
<!– add an option to place custom rules at the beginnig of .htaccess (2 of 2) and increase columns to 80–>
<!– +++++ start of added code +++++ –>
<tr valign=”top”>
<th scope=”row”><?php _e(‘Put these rules at the beginning’, ‘all-in-one-wp-security-and-firewall’)?>:</th>
<td>
<input name=”aiowps_place_custom_rules_at_the_beginning” type=”checkbox”<?php if($aio_wp_security->configs->get_value(‘aiowps_place_custom_rules_at_the_beginning’)==’1′) echo ‘ checked=”checked”‘; ?> value=”1″/>
<span class=”description”><?php _e(‘Check this if you want these rules placed before all other security rules of the plugin; otherwise they will be placed after all other rules’, ‘all-in-one-wp-security-and-firewall’); ?></span>
</td>
</tr>
<!– +++++ end of added code +++++ –><tr valign=”top”>
<th scope=”row”><?php _e(‘Enter Custom .htaccess Rules:’, ‘all-in-one-wp-security-and-firewall’)?></th>
<td>
<!– ===== start of modified code ===== –>
<textarea name=”aiowps_custom_rules” rows=”35″ cols=”80″><?php echo htmlspecialchars($aio_wp_security->configs->get_value(‘aiowps_custom_rules’)); ?></textarea>
<!– ===== end of modified code ===== –>
<br />
<span class=”description”><?php _e(‘Enter your custom .htaccess rules/directives.’,’all-in-one-wp-security-and-firewall’);?></span>
</td>
</tr>`wp-security-configure-settings.php
//add an option to place custom rules at the beginning of .htaccess (1 of 3) // +++++ start of added code +++++ $aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_the_beginning','');//Checkbox // +++++ end of added code +++++ $aio_wp_security->configs->set_value('aiowps_custom_rules',''); (...) //add an option to place custom rules at the beginning of .htaccess (2 of 3) // +++++ start of added code +++++ $aio_wp_security->configs->add_value('aiowps_place_custom_rules_at_the_beginning','');//Checkbox // +++++ end of added code +++++ $aio_wp_security->configs->add_value('aiowps_custom_rules',''); (...) //add an option to place custom rules at the beginning of .htaccess (3 of 3) // +++++ start of added code +++++ $aio_wp_security->configs->set_value('aiowps_place_custom_rules_at_the_beginning','');//Checkbox // +++++ end of added code +++++ $aio_wp_security->configs->set_value('aiowps_custom_rules','');
wp-security-utility-htaccess.php
//add an option to place custom rules at the beginning of .htaccess $rules = ""; // ===== start of modified code ===== global $aio_wp_security; if($aio_wp_security->configs->get_value('aiowps_place_custom_rules_at_the_beginning')=='1') { $rules .= AIOWPSecurity_Utility_Htaccess::getrules_custom_rules(); } $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_wp_file_access(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_basic_htaccess(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_pingback_htaccess(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_debug_log_access_htaccess(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_disable_index_views(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_blacklist(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_disable_trace_and_track(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_forbid_proxy_comment_posting(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_deny_bad_query_strings(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_advanced_character_string_filter(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_6g_blacklist(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_5g_blacklist(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_brute_force_prevention(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_block_spambots(); $rules .= AIOWPSecurity_Utility_Htaccess::getrules_enable_login_whitelist(); $rules .= AIOWPSecurity_Utility_Htaccess::prevent_image_hotlinks(); if($aio_wp_security->configs->get_value('aiowps_place_custom_rules_at_the_beginning')=='') { $rules .= AIOWPSecurity_Utility_Htaccess::getrules_custom_rules(); } // ===== end modified code =====
-
This reply was modified 3 years, 10 months ago by
aldemarcalazans.
-
This reply was modified 3 years, 10 months ago by
- The topic ‘Custom rules in the beginning oh .htaccess file’ is closed to new replies.