Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't manage to run on Localhost (Mamp) #25

Open
foxnoodles opened this issue Mar 6, 2023 · 7 comments
Open

Can't manage to run on Localhost (Mamp) #25

foxnoodles opened this issue Mar 6, 2023 · 7 comments

Comments

@foxnoodles
Copy link

foxnoodles commented Mar 6, 2023

@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
Copy link
Author

Hello?

@oelna
Copy link
Owner

oelna commented Mar 8, 2023

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.

@foxnoodles
Copy link
Author

foxnoodles commented Mar 8, 2023

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();
	}

@oelna
Copy link
Owner

oelna commented Mar 8, 2023

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!

@foxnoodles
Copy link
Author

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
Copy link
Author

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

@ivan-avalos
Copy link

ivan-avalos commented Sep 2, 2023

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants