Fuelphp remove public from base_url - fuelphp

I ran in to a problem what icant really solve with fuel php.
I added the htaccess to te root, now i can acces my site like this www.mysite.com/wlecome, se the public is removed, but i cant find a way to remove the public when i use the Config::get('base_url'); and the Response::redirect();
The base_url in the config.php is set to null, if i pass the site url to it, that way the assets are not rendering correctly.
I would really appreciate if someone could give me a hint how to remove the public from these.
Thank you.

This sounds like you've installed the complete FuelPHP installation INSIDE the docroot, instead of outside, and making the public folder your docroot, which is the recommended way of installation.
If this is the case, move everything in the public directory one folder up, so it's in the docroot again, and remove the public folder, which is no longer needed.
Note that a setup like this leaves your code accessible via the browser, so you might want to add some htaccess to prevent that.

I know its not the prettiest but i usually do this way.
I open up Config.php
and pass under base url
'site_url' => 'your site url here',
and you cann call it this way Config::get('site_url');
Hope it helps you

Instead of using a .htaccess you can set a VirtualHost to go from http://project.dev/ to /var/www/project/public

Related

Joomla! Too Many Redirects

I'm trying to build a website (it's not my first time), using latest version of Joomla! (3.8.10), but I have a problem - tabs in the main menu don't work. When I try to go to other page, I have an error:
ERR_TOO_MANY_REDIRECTS
I almost solved this problem by changing:
$sef="1"
to
$sef="0"
in configuration.php, but it caused strangely long addresses.
Ok, I found the solution. Need to add:
$_SERVER['HTTPS']='on';
in index.phpfile, behind the <?php
Maybe someone will use it.
This is most likely a problem with your .htaccess file. When you change $sef=0, you are basically telling the system to not use your .htaccess file. I suggest backing up your current one and replacing with the default Joomla one. It is the one that comes in the download package and is named htaccess.txt. Upload and rename to .htaccess to overwrite existing.

How do relative URLs work in Sinatra?

I am hosting my Sinatra application using Apache with Passenger. It's hosted within a subfolder -- meaning, my main site is example.com, my application is at example.com/popcorn.
So I have a get '/' route, and that works fine. The problem is that my view includes a HTML form that makes a post request to upload, and the post '/upload' route isn't handling it. Instead of example.com/popcorn/upload, it's trying to get example.com/upload.
So I figure okay, not the ideal solution, but for now I'll hardcode the form action URL. But that doesn't work either -- making the action popcorn/upload fails too. This is where I get a little baffled, and my Google-fu was weak, I couldn't find help there.
Maybe I could have some kind of Apache rewrite rule, but is that the correct solution? Am I missing something? I would really appreciate a tip here because it feels like I've messed up something very simple and it's really bugging me.
You probably want the url helper method. That takes into account where the app is mounted on the server:
url('/upload')
The above code will evaluate to something like this:
http://example.com/popcord/upload
Inside your app you shouldn’t need to change anything, this will be routed to the existing post '/upload' handler.

how do i redirect a specific path to another path in nginx?

I need to redirect a specific path:
mydomain.com/old-path/
to a new path, permanently:
mydomain.com/new-path/
i am using elgg software (elgg.org) and presently when someone navigates to the /old-path/ folder they view a page (rather than a folder listing) - thus no specific page name is used.
i tried the various methods of redirecting that can be found via google for nginx and so far none have had any effect. they mostly are either for a specific page or a directory, yet what i am doing, is, i suppose, technically neither a specific page or a directory..
anyone know how to achieve this?
thanks
You can use nginx HttpRewriteModule to do this.
rewrite ^/old-directory/(.*)$ /new-directory/$1 last;

What is this type of redirection called

My website uses Response.Redirect("~/Main/Main.aspx") type redirects all over the place. Worked flawlessly until the Webhost4Life (don't groan) decided to migrate my website and in doing so managed to completely break it.
What is this "~" mechanism actually called?
Thanks, Rob.
PS. The bug is that Response.Redirect("~/main.aspx") from http://backdoor.whatpub.org/default.aspx doesn't go to http://backdoor.whatpub.org/main.aspx (as it did on the old server) but to http://backdoor.whatpub.org/live/main.aspx. Live is the name of the sub-folder containing the website and AFAIK means that the root is getting returned as http://backdoor.whatpub.org/live and not just http://backdoor.whatpub.org
it is a shortcut to HttpRuntime.AppDomainAppVirtualPath property, which refers to the virtual application root, not the root of the web server.

Weird behaviour of Zend_Session_Namespace

Follow up to this:
Why can't I pass user sessions between subdomains?
I followed the advice there and used :
ini_set('session.cookie_domain','mydomain');
(with and without a dot before mydomain) as the first line of index.php in the public folder as advised there and in other links around the web.
The problem is that it completely "ruined" Zend_Session_Namespace inside my application.
While it persisted among calls (as it should) of the page, now every time it is being called it is behaving as a new session is being instantiated, without holding all variables.
Any ideas on how to fix this?
Have you tried setting the cookie domain via Zend_Session?
$config['cookie_domain'] = 'mydomain';
Zend_Session::setOptions($config);