microblog icon indicating copy to clipboard operation
microblog copied to clipboard

Can't manage to run on Localhost (Mamp)

Open foxnoodles opened this issue 2 years ago • 7 comments

@oelna I'm getting too many redirects error.

DB file was automatically created so at least it ran through some of it.

.htaccess looks like this. I've only added RewriteCond %{SERVER_PORT} 8888. because the default url for mamp is localhost:8888 but the error persists even without my line.

AddCharset UTF-8 .xml
AddCharset UTF-8 .json

AddType application/atom+xml .xml
AddType application/json .json

<Files ~ "\.db$">
  <IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
  </IfModule>
  <IfModule mod_authz_core.c>
    Require all denied
  </IfModule>
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /microblog

# friendly URLs
RewriteRule ^feed/json/?$ feed/feed.json [L]
RewriteRule ^feed/atom/?$ feed/feed.xml [L]

RewriteCond %{SERVER_PORT} 8888
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>

Error log says: RewriteCond: bad flag delimiters

Any ideas?

foxnoodles avatar Mar 06 '23 19:03 foxnoodles

Hello?

foxnoodles avatar Mar 08 '23 11:03 foxnoodles

I'm sorry, I can't really look into this right now. You could try removing (or commenting out) all of the htaccess, to see if it runs, and add the lines back in one by one, which is what I would do. I don't have a MAMP setup right now, but I'll leave this issue open. In case you find out what caused the issue, I'll gladly update the htaccess to reflect your changes. Sorry I can't be of more help right now. I'll look into it when I can.

oelna avatar Mar 08 '23 11:03 oelna

Found it. templates/timeline.inc.php line 18 to 21 causes redirect loop. For some reason there is a check to redirect to home page if there are no posts. That obviously causes a loop.

if(empty($posts)) {
		header('Location: '.$config['url']);
		die();
	}

foxnoodles avatar Mar 08 '23 12:03 foxnoodles

Ah, thanks for the info though. This looks like a much more reasonable change to take on. I guess the initial setup process has not been revisited for a while now. I'll keep it in mind!

oelna avatar Mar 08 '23 13:03 oelna

No probs! Also, I'm having problems with login/logout on Mamp. For som reason it does not want to set/unset the cookie time. The it out of the sudden logges in but does not want to logout. Weird. I've checked the cookie value and it somehow gets stuck. No idea why. Checked PHP setup and there's nothing out of the ordinary.

foxnoodles avatar Mar 08 '23 14:03 foxnoodles

Ok I've figured that one out as well. FYI Cookie does not get set because of this check (found in 3 files) $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;

localhost should be edited to match your setup. in my case it was localhost:8888

foxnoodles avatar Mar 08 '23 18:03 foxnoodles

Ok I've figured that one out as well. FYI Cookie does not get set because of this check (found in 3 files) $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;

localhost should be edited to match your setup. in my case it was localhost:8888

It should be changed to:

$domain = ($_SERVER['SERVER_NAME'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;

ivan-avalos avatar Sep 02 '23 06:09 ivan-avalos