eschnou / storytlr

Storytlr is an opensource lifestreaming and microblogging platform written in PHP. Note: The default branch (master) is the development branch, if you need a stable version, see the release-XX branches, tags, or downloads.
http://storytlr.org
Other
216 stars 57 forks source link

Problem with web.host / web.path and friendly URLs #36

Open JimmySwan opened 13 years ago

JimmySwan commented 13 years ago

Hello again.

Theme doesn't load with this url: http://www.mydomain.com/story/index.php

But it loads with the following url: http://www.mydomain.com/story/

config ini set to: web.host=www.mydomain.com web.path=/story/ web.redirect = 1

Plus I can't load urls like: http://www.mydomain.com/story/admin/design/ Error message says: The requested URL /story/admin/design/ was not found on this server.

BUT the page loads with the following url: http://www.mydomain.com/story/index.php/admin/design/

But the theme doesn't load due to a wrong path to the css and js files obviously.

Not sure whats going on here. Any help appreciated.

jmhobbs commented 13 years ago

Can you try this in your .htaccess?

RewriteEngine on
RewriteBase /story/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /story/index.php 
JimmySwan commented 13 years ago

These are working just fine now, thanks.... http://www.mydomain.com/story/ http://www.mydomain.com/story/admin/

But http://www.mydomain.com/story/index.php still loads without the design and all.

And the site is soooo slow in general. I've tried a few other db driven websites on the same server and they are as fast as always.

jmhobbs commented 13 years ago

Not sure what the slowness is about...

The base tag is changing with the http://www.mydomain.com/story/index.php to be "http://www.mydomain.com/story/index.php"

The problem is the thisUrl method on line 23 of protected/library/Stuffpress/View/Helper/Base.php but I'm not sure of the fix just yet.

You could try doing this instead, but I have no idea about the side effects. Probably the correct fix is to alter the layouts.

    // Returns the full URL to the current page
    public function thisUrl() {
            /*
            $host   = Zend_Controller_Front::getInstance()->getRequest()->get('SERVER_NAME');
            $base   = Zend_Controller_Front::getInstance()->getRequest()->getBaseUrl();
            return trim("http://{$host}{$base}", '/');
            */
            return $this->serviceUrl();
    }

The layouts that would need to be changed are:

protected/application/admin/views/layouts/bookmarklet.phtml
protected/application/admin/views/layouts/default.phtml
protected/application/public/views/layouts/default.phtml
protected/application/public/views/layouts/dialog.phtml
protected/application/public/views/layouts/embed_page.phtml
protected/application/public/views/layouts/embed_story.phtml
protected/application/public/views/layouts/error.phtml
protected/application/public/views/layouts/page_mapview.phtml
protected/application/public/views/layouts/story.phtml
protected/application/public/views/layouts/story_mapcontainer.phtml
protected/application/public/views/layouts/story_mapview.phtml

Sorry I can't give better guidance, I don't have access to an instance I can play with right now.

JimmySwan commented 13 years ago

Hey mate, thanks for the replay. I might wait for this to get fixed in the next release. I have to look into the slowness first anyway... If I can't fix that I'll have to abandon the whole Idea anyway.

In Firebug I can see that GET home?tab=0 is causing the slowness. Even when I delete all sources, widgets and pages, there is a 4 to 5 seconds waiting period before retrieving the page. DNS lookup, establishing a connection and the retrieving itself is a matter of a few milliseconds. Weird. Might have to try a different server to see if that changes anything.

Cheers

eschnou commented 13 years ago

Is this problem solved or not ? The site is not available for testing anymore, so i could not look into it.

JimmySwan commented 13 years ago

yes and no...

friendly urls do work now but as soon as you add index.php to the url the site doesn't work properly anymore. I was able to replicate the same issue on your website as well...

ta

eschnou commented 13 years ago

The url is indeed used as the base, and if you add index.php it will break things. I don't see this as an issue since the site works great with friendly urls. May I ask why you want to add index.php at the end when it works great without ?

If you really need the index.php suffix, the you could add a rule in your apache mod_rewrite rules to strip it. That would be the simplest fix and won't require you to change anything to the code.

JimmySwan commented 13 years ago

well it became an issue when the installation wizard automatically used the index.php in the config.ini and the site didn't work properly after the initial installation.

now that I know it'll break things I can avoid having the index.php in the url and strip it via a rewrite condition as a precaution...

thanks

eschnou commented 13 years ago

Thats an issue indeed. Since the site needs mod_rewrite to work, I'll add a check at the install stage to verify if it is properly setup and prevent the user moving forward without mod_rewrite. Thanks !

JimmySwan commented 13 years ago

Great, thank you!

haaami01 commented 3 years ago

https://www.mydomain.com/story/Unfortunately, nstate also gives error code.