WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] mod-rewrite error (5 posts)

  1. thaKing
    Member
    Posted 5 years ago #

    using fGallery and long ago i had used the mod-rewrite option for my photos (don't remember why i had to use it, just did) and i put "photos" in the mod-rewrite box and clicked "update mod-rewrite"..tonight, i removed the word "photos" and clicked the button again...now i cannot get to my site...how do i fix this?

    i really hope someone can assist...

  2. thaKing
    Member
    Posted 5 years ago #

    looking at the database, in the options table, there is an option for "page" and an option for "baseurl"...these specifically relate to fGallery...would one of those have affected it? i assumed since i can't get to the site at all, that it wouldn't have to do with the options of fGallery, but wordpress...

  3. thaKing
    Member
    Posted 5 years ago #

    ok, here's what i've found in the code for the gallery....hopefully someone can help figure out what i need to do:

    function fim_rewrite_rule()
    {
        // Complete url
        $url = get_bloginfo('wpurl');
        $urlparts = parse_url($url);
    	$base = get_option('fim_baseurl');
    	$rewrite = "# BEGIN FGALLERY\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteRule ^$base/?([^/]*)?/?([^/]*)?/?([^/]*)?/?([^/]*)?/?$   $urlparts[path]/wp-content/plugins/fgallery/fim_photos.php?$1=$2&$3=$4 [QSA,L]\n</IfModule>\n# END FGALLERY\n";
    
    	return $rewrite;
    }
    if(isset($_POST['rewrite']))
    {
    	$url = $_POST['baseurl'];
    	$url = strtolower($url);
    	$url = str_replace(" ", "_", $url);
    	update_option('fim_baseurl', $url);
    	$file = "../.htaccess";
    
    	if(is_writable($file))
    	{
    		$content = file_get_contents ($file);
    		$content = preg_replace("/(# BEGIN FGALLERY)(\n+.*)*(# END FGALLERY)\n/", "", $content);
    
    		$content = fim_rewrite_rule().$content;
    		$f = fopen("../.htaccess", "w");
    		fwrite($f, $content);
    		fclose($f);
    		//echo "<pre>$content</pre>";
    		echo "<div class='updated fade' id='message'><p>".__('Mod ReWrite rules successfully updated', 'fgallery').".</p></div>";
    
    	}
    	else
    	{
    		?><div class="wrap">
    		<h2><?php _e("Add ReWrite rules", 'fgallery');?></h2>
    		<?php _e(".htaccess is not writable so you have to add add the following manually", 'fgallery');
    		echo "<p>".__('This should be at the TOP of your .htacces file before the WordPress rules', 'fgallery').".</p>";?>
    		<textarea cols="100" rows="5" wrap="off"><?php echo fim_rewrite_rule(); ?></textarea></div><?php
    	}
    
    }

    do i need to look at my htaccess file and correct something there?

  4. thaKing
    Member
    Posted 5 years ago #

    here's my htaccess file:

    # BEGIN FGALLERY
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^/?([^/]*)?/?([^/]*)?/?([^/]*)?/?([^/]*)?/?$   /wp-content/plugins/fgallery/fim_photos.php?$1=$2&$3=$4 [QSA,L]
    </IfModule>
    # END FGALLERY
    # BEGIN FGALLERY
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^photos/?([^/]*)?/?([^/]*)?/?([^/]*)?/?([^/]*)?/?$   /wp-content/plugins/fgallery/fim_photos.php?$1=$2&$3=$4 [QSA,L]
    </IfModule>
    # END FGALLERY
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
  5. thaKing
    Member
    Posted 5 years ago #

    no one knows anything about mod-rewrites?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.