WordPress.org

Ready to get started?Download WordPress

Forums

My Calendar
.htaccess code overwriting existing .htaccess code (2 posts)

  1. AITpro
    Member
    Posted 2 years ago #

    I have not been able to recreate this possible issue on a XAMPP testing site.
    This is the original issue.
    When activating the My Calendar plugin the root .htaccess code is overwritten with several instances of the default WP rewrite code between BEGIN WordPress and END WordPress

    The section of code that looks like it might be capable of doing this is located in my-calendar-core.php from code lines 11-33, but as i stated i have not been able to recreate the issue.

    function my_calendar_add_feed() {
    	global $wp_rewrite, $wpdb;
    	if ( get_option('mc_show_rss') == 'true' ) {
    		add_feed( 'my-calendar-rss', 'my_calendar_rss' );
    	}
    	if ( get_option('mc_show_ical') == 'true' ) {
    		add_feed( 'my-calendar-ics', 'my_calendar_ical' );
    	}
    	if ( get_option('mc_show_print') == 'true' ) {
    		add_feed( 'my-calendar-print', 'my_calendar_print' );
    	}
    	if ( get_option('mc_show_rss') == 'true' || get_option('mc_show_ical') == 'true' || get_option('mc_show_print') == true ) {
    		add_action('generate_rewrite_rules', 'mc_rewrite_rules');
    		$wp_rewrite->flush_rules();
    	}
    }
    
    function mc_rewrite_rules( $wp_rewrite ) {
      $new_rules = array(
        'feed/(.+)' => 'index.php?feed='.$wp_rewrite->preg_index(1)
      );
      $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
    }

    This is the .htaccess code that is being added to the root .htaccess file when activating My Calendar.

    # END WordPress is replaced by WP htaccess code.
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /employees/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /employees/index.php [L]
    </IfModule>
    
    # END WordPress
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /employees/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /employees/index.php [L]
    </IfModule>
    
    # END WordPress
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /employees/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /employees/index.php [L]
    </IfModule>
    
    # END WordPress
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /employees/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /employees/index.php [L]
    </IfModule>
    
    # END WordPress
    # This removes all of the BPS security code and replaces it with just the default WP htaccess code
    # To restore this file use BPS Restore or activate BulletProof Mode for your Root folder again.
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /employees/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /employees/index.php [L]
    </IfModule>
    
    # END WordPress

    If i "lock" the root .htaccess file with 404 Read Only permissions this issue does not occur because the file is not writable.

    If i leave My Calendar activated and then try to write to the root .htaccess file with the BulletProof Security .htaccess editor or with any inline / online file editor the new file edits are not written and are ignored and the root .htaccess file is not updated.

    http://wordpress.org/extend/plugins/my-calendar/

  2. Joe Dolson
    Member
    Plugin Author

    Posted 2 years ago #

    I have a second report of a bug along these lines relating to .htaccess issues; but I haven't been able to reproduce either on my own test sites yet. Nonetheless, this is of concern, and I'm definitely working on it. If you could either send me a support request via the built-in support form or submit a bug report at http://www.joedolson.com/articles/bugs/, I'd greatly appreciate it. (Both would be nice, too.)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic