Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    Oh my god.

    You are an angel sent from the dev gods haha im in on MAMP! And my site is live on the new server too!

    THANK YOU!!

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    I think thats exactly what it is.. My brother (who posted the first comment) tried to change the url in the options section of the wp admin backend of the MAMP site which is what set off the loop. But I havent been able to log into it to change it back… This is my first website so im sorry if (for) being really silly!
    I think I just duplicated the site

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    Yeah I did thats whats strange.. I just deleted the one out of MAMP and copied the same one from the new server in.. now its not coming up with the admin screen when i direct to wp-admin but redirects straight to this:

    http://nicolasgaillard.com/wordpress/wp-login.php?redirect_to=http%3A%2F%2Flocalhost%3A81%2Fwp-admin%2F&reauth=1

    before it was allowing me to input the admin credentials and only then redirecting me to
    http://nicolasgaillard.com/wordpress/wp-login.php

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    Ok.. so I removed the code you pasted above from the htaccess files on both my server and the new one I am attempting to move the site to.
    Now the ‘locked out’ redirect loop is broken.
    But the wp admin on my MAMP server is redirecting to the new server which is allowing me to log into WordPress but its a new install and not reading my content.. and I still cant log in to the backend on MAMP.. any thoughts?

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    contact form 7
    contact form plugin
    gecka submenu
    iire social lite
    lightbox plus
    nexgen gallery
    options framework
    photomosaic for wordpress
    portfolio post type
    redirection
    social media widget
    synved options
    use any font
    wordpress custom sidebar
    wordpress move

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    Im afraid its still re-directing.. I’ve changed it back to the backup.. Could it be another file?

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    <?php
    
    class Red_Htaccess
    {
    	var $settings;
    	var $items;
    
    	function Red_Htaccess ($settings)
    	{
    		foreach ($settings AS $key => $value)
    			$this->settings[$key] = $value;
    	}
    
    	function encode_from ($url)
    	{
    		return '^'.$this->encode ($url).'$';
    	}
    
    	function encode2nd ($url)
    	{
    		$url = urlencode ($url);
    		$url = str_replace ('%2F', '/', $url);
    		$url = str_replace ('%3A', ':', $url);
    		$url = str_replace ('+', '%20', $url);
    		$url = str_replace ('%24', '$', $url);
    		return $url;
    	}
    
    	function encode ($url)
    	{
    		$url = urlencode ($url);
    		$url = str_replace ('%2F', '/', $url);
    		$url = str_replace ('+', '%20', $url);
    		$url = str_replace ('.', '\\.', $url);
    		return $url;
    	}
    
    	function encode_regex ($url)
    	{
    		$url = str_replace (' ', '%20', $url);
    		$url = str_replace ('.', '\\.', $url);
    		$url = str_replace ('\\.*', '.*', $url);
    		$url = str_replace ('%24', '$', $url);
    		return $url;
    	}
    
    	function add_referrer ($item, $match)
    	{
    		$from = $this->encode_from (ltrim ($item->url, '/'));
    		if ($item->regex)
    			$from = $this->encode_regex (ltrim ($item->url, '/'));
    
    		if (($match->url_from || $match->url_notfrom) && $match->referrer)
    		{
    			$this->items[] = sprintf ('RewriteCond %%{HTTP_REFERER} %s [NC]', ($match->regex ? $this->encode_regex ($match->referrer) : $this->encode_from ($match->referrer)));
    
    			if ($match->url_from)
    			{
    				$to = $this->target ($item->action_type, $match->url_from, $item->action_code, $item->regex);
    				$this->items[] = sprintf ('RewriteRule %s %s', $from, $to);
    			}
    
    			if ($match->url_notfrom)
    			{
    				$to = $this->target ($item->action_type, $match->url_notfrom, $item->action_code, $item->regex);
    				$this->items[] = sprintf ('RewriteRule %s %s', $from, $to);
    			}
    		}
    	}
    
    	function add_agent ($item, $match)
    	{
    		$from = $this->encode (ltrim ($item->url, '/'));
    		if ($item->regex)
    			$from = $this->encode_regex (ltrim ($item->url, '/'));
    
    		if (($match->url_from || $match->url_notfrom) && $match->user_agent)
    		{
    			$this->items[] = sprintf ('RewriteCond %%{HTTP_USER_AGENT} %s [NC]', ($match->regex ? $this->encode_regex ($match->user_agent) : $this->encode2nd ($match->user_agent)));
    
    			if ($match->url_from)
    			{
    				$to = $this->target ($item->action_type, $match->url_from, $item->action_code, $item->regex);
    				$this->items[] = sprintf ('RewriteRule %s %s', $from, $to);
    			}
    
    			if ($match->url_notfrom)
    			{
    				$to = $this->target ($item->action_type, $match->url_notfrom, $item->action_code, $item->regex);
    				$this->items[] = sprintf ('RewriteRule %s %s', $from, $to);
    			}
    		}
    	}
    
    	function add_url ($item, $match)
    	{
    		$to   = $this->target ($item->action_type, $match->url, $item->action_code, $item->regex);
    		$from = $this->encode_from (ltrim ($item->url, '/'));
    		if ($item->regex)
    			$from = $this->encode_regex (ltrim ($item->url, '/'));
    
    		if ($to)
    			$this->items[] = sprintf ('RewriteRule %s %s', $from, $to);
    	}
    
    	function action_random ($data, $code, $regex)
    	{
    		// Pick a WP post at random
    		global $wpdb;
    
    		$post = $wpdb->get_var ("SELECT ID FROM {$wpdb->posts} ORDER BY RAND() LIMIT 0,1");
    		$url  = parse_url (get_permalink ($post));
    
    		return sprintf ('%s [R=%d,L]', $this->encode ($url['path']), $code);
    	}
    
    	function action_pass ($data, $code, $regex)
    	{
    		if ($regex)
    			return sprintf ('%s [L]', $this->encode2nd ($data), $code);
    		else
    			return sprintf ('%s [L]', $this->encode2nd ($data), $code);
    	}
    
    	function action_error ($data, $code, $regex)
    	{
    		if ($code == '410')
    			return '/ [G,L]';
    		return '/ [F,L]';
    	}
    
    	function action_url ($data, $code, $regex)
    	{
    		if ($regex)
    			return sprintf ('%s [R=%d,L]', $this->encode2nd ($data), $code);
    		else
    			return sprintf ('%s [R=%d,L]', $this->encode2nd ($data), $code);
    	}
    
    	function target ($action, $data, $code, $regex)
    	{
    		$target = 'action_'.$action;
    
    		if (method_exists ($this, $target))
    			return $this->$target ($data, $code, $regex);
    		return '';
    	}
    
    	function add ($item)
    	{
    		$target = 'add_'.$item->match_type;
    
    		if (method_exists ($this, $target))
    			$this->$target ($item, $item->match);
    	}
    
    	function generate ($name)
    	{
    		// Head of redirection section - do not localize this
    		global $redirection;
    
    		$text[] = '# Created by Redirection Module: '.$name;
    		$text[] = '# '.date ('r');
    		$text[] = '# Redirection '.$redirection->version ().' - http://urbangiraffe.com/plugins/redirection/';
    		$text[] = '';
    
    		// Default blocked files - I can't think of a reason not to block these
    		$text[] = '<Files .htaccess,.svn>';
    		$text[] = 'order allow,deny';
    		$text[] = 'deny from all';
    		$text[] = '</Files>';
    		$text[] = '';
    
    		// PHP options
    		if (isset ($this->settings['error_level']) && $this->settings['error_level'] != 'default')
    			$text[] = 'php_value error_reporting '.($this->settings == 'none' ? '0' : 'E_ALL');
    
    		if (isset ($this->settings['memory_limit']) && $this->settings['memory_limit'] != 0)
    			$text[] = 'php_value memory_limit '.$this->settings['memory_limit'].'M';
    
    		if ($this->settings['allow_ip'] || $this->settings['ban_ip'])
    		{
    			$text[] = '';
    			$text[] = 'order allow,deny';
    			if ($this->settings['ban_ip'])
    			{
    				$ips = array_filter (explode (',', $this->settings['ban_ip']));
    				if (count ($ips) > 0)
    				{
    					foreach ($ips AS $ip)
    						$text[] = 'deny from '.$ip;
    				}
    			}
    
    			if ($this->settings['allow_ip'])
    			{
    				$ips = array_filter (explode (',', $this->settings['allow_ip']));
    				if (count ($ips) > 0)
    				{
    					foreach ($ips AS $ip)
    						$text[] = 'allow from '.$ip;
    				}
    			}
    			else
    				$text[] = 'allow from all';
    		}
    
    		// mod_rewrite section
    		$text[] = '';
    		$text[] = 'Options +FollowSymlinks';
    		$text[] = '';
    		$text[] = '<IfModule mod_rewrite.c>';
    
    		if ($this->settings['canonical'] != 'default')
    		{
    			$text[] = 'RewriteEngine On';
    			$base   = $this->settings['site'];
    			if ($base == '')
    				$base = get_option ('home');
    
    			$parts = parse_url ($base);
    			$base  = str_replace ('www.', '', $parts['host']);
    
    			if ($this->settings['canonical'] == 'nowww')
    			{
    				$text[] = 'RewriteCond %{HTTP_HOST} ^www\.'.str_replace ('.', '\\.', $base).'$ [NC]';
    				$text[] = 'RewriteRule ^(.*)$ http://'.$base.'/$1 [R=301,L]';
    			}
    			else if ($this->settings['canonical'] == 'www')
    			{
    				$text[] = 'RewriteCond %{HTTP_HOST} ^'.str_replace ('.', '\\.', $base).'$ [NC]';
    				$text[] = 'RewriteRule ^(.*)$ http://www.'.$base.'/$1 [R=301,L]';
    			}
    
    			$text[] = '';
    		}
    
    		if ($this->settings['strip_index'] == 'yes')
    		{
    			$text[] = 'RewriteCond %{THE_REQUEST} (.*)index\.(php|htm|html)\ HTTP/';
    			$text[] = 'RewriteRule ^(.*)index\.(php|html|htm)$ $1 [R=301,NC,L]';
    			$text[] = '';
    		}
    
    		// Add redirects
    		if (is_array ($this->items))
    			$text = array_merge ($text, $this->items);
    
    		// End of mod_rewrite
    		$text[] = '</IfModule>';
    		$text[] = '';
    
    		if ($this->settings['raw'])
    			$text[] = $this->settings['raw'];
    
    		// End of redirection section
    		$text[] = '# End of Redirection';
    		$text[] = '';
    
    		$text = implode ("\r\n", $text);
    		$text = str_replace ("\r\n\r\n\r\n", "\r\n", $text);
    		$text = str_replace ("\r\n\r\n\r\n", "\r\n", $text);
    		return $text;
    	}
    
    	function save ($filename, $name)
    	{
    		$text = $this->generate ($name);
    
    		// Does the file already exist?
    		if (file_exists ($filename))
    		{
    			$existing = @file_get_contents ($filename);
    
    			// Remove any existing Redirection module
    			$text .= preg_replace ('@# Created by Redirection Module: '.$name.'(.*?)# End of Redirection@s', '', $existing);
    		}
    
    		$file = @fopen ($filename, 'w');
    		if ($file)
    		{
    			$text = str_replace ("\r\n\r\n\r\n", "\r\n", $text);
    			$text = str_replace ("\r\n\r\n\r\n", "\r\n", $text);
    
    			fwrite ($file, $text);
    			fclose ($file);
    			return true;
    		}
    
    		return false;
    	}
    }

    [Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    I do indeed, i’ve got it open now – what should I be looking for?
    I really appreciate your help! Thanks!

    Forum: Localhost Installs
    In reply to: Locked-out loop
    Thread Starter una_s88

    (@una_s88)

    Yup – in the options section

Viewing 9 replies - 1 through 9 (of 9 total)