Results 1 to 4 of 4

Thread: suggestion dido for lib .htaccess

  1. #1
    Join Date
    Jul 2004
    Posts
    37

    Default suggestion dido for lib .htaccess

    Hy dido
    why not a function like this to modify .htaccess
    Code:
    function update_htaccess($new_content_htaccess){
    	global $path_to_htaccess;
    
    	$modifying_file=$path_to_htaccess.".htaccess"; 
    	
    	$fp=fopen($modifying_file,"r"); 
    	$content=fread($fp,filesize($modifying_file));
    	fclose($fp);
    
    	if (eregi("content indexu",$content)) {
    		$new_content=preg_replace("/#content indexu do not touch(.*)#End content indexu/s", "#content indexu do not touch\n".$new_content_htaccess."/n#End content indexu",$content);
    	
    		$fp=fopen($modifying_file,"w");
    		fwrite($fp,$new_content);
    		fclose($fp);
    	} else {
                             $new_content="#content indexu do not touch\n".$new_content_htaccess."/n#End content indexu";
    
    		$fp=fopen($modifying_file,"a");
    		fwrite($fp,$new_content);
    		fclose($fp);
    	} 	
    	
    	return true;
    }

  2. #2
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    What is the problem with the current version?

  3. #3
    Join Date
    Jul 2004
    Posts
    37

    Default

    bah not a big problem
    but when a dmin check or recheck in his admin area Enable mod rewrite

    only your content in .htaccess is writte (you're on fopen w)
    with this function you keep the older content and add or change indexu one

    the litle problem i find that if the tag MogRewrite is already declare in htaccess and in your code there is also but don't think it will make error


  4. #4
    Join Date
    Aug 2001
    Location
    Indonesia
    Posts
    3,732

    Default

    I see, it's a nice idea. Indexu should never rewrite other custom .htaccess command by user.

    We'll implement it in next release.

Similar Threads

  1. Install error with .htaccess
    By player77 in forum v5.x
    Replies: 7
    Last Post: 03-09-2006, 07:04 PM
  2. 5.0.1 htaccess file
    By persut in forum v5.x
    Replies: 1
    Last Post: 01-10-2006, 07:24 AM
  3. .htaccess question
    By aladdin1 in forum v5.x
    Replies: 7
    Last Post: 03-21-2005, 02:02 PM
  4. Unable copy to file and .htaccess!!!
    By bycegerxwin in forum v5.x
    Replies: 7
    Last Post: 09-28-2002, 10:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •