htaccess.php (1186B)
1 <?php 2 namespace Elementor\Core\Debug\Classes; 3 4 use Elementor\Modules\SafeMode\Module as Safe_Mode; 5 6 class Htaccess extends Inspection_Base { 7 8 private $message = ''; 9 10 public function __construct() { 11 $this->message = esc_html__( 'Your site\'s .htaccess file appears to be missing.', 'elementor' ); 12 } 13 14 public function run() { 15 $safe_mode_enabled = get_option( Safe_Mode::OPTION_ENABLED, '' ); 16 if ( empty( $safe_mode_enabled ) || is_multisite() ) { 17 return true; 18 } 19 20 $permalink_structure = get_option( 'permalink_structure' ); 21 if ( empty( $permalink_structure ) || empty( $_SERVER['SERVER_SOFTWARE'] ) ) { 22 return true; 23 } 24 25 $server = strtoupper( $_SERVER['SERVER_SOFTWARE'] ); 26 27 if ( strstr( $server, 'APACHE' ) ) { 28 $htaccess_file = get_home_path() . '.htaccess'; 29 $this->message .= ' ' . sprintf( esc_html__( 'File Path: %s', 'elementor' ), $htaccess_file ) . ' '; 30 return file_exists( $htaccess_file ); 31 } 32 return true; 33 } 34 35 public function get_name() { 36 return 'apache-htaccess'; 37 } 38 39 public function get_message() { 40 return $this->message; 41 } 42 43 public function get_help_doc_url() { 44 return 'https://go.elementor.com/preview-not-loaded/#htaccess'; 45 } 46 }