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

Cannot post to root when root is subdirectory #634

Closed
OhMyMndy opened this issue Sep 17, 2014 · 3 comments
Closed

Cannot post to root when root is subdirectory #634

OhMyMndy opened this issue Sep 17, 2014 · 3 comments

Comments

@OhMyMndy
Copy link

It is not possible to send a POST request to the root of your application if your application is in a subdirectory (localhost/app/ for example) with a form generated by form_open.

The form action is /localhost/app which redirects to /localhost/app/ so the POST variables are lost...

I solved this temporarily to manually set the url for the form with a trailing slash, but this shouldn't be the way I guess...

This is the code I have used in my page
function onStart(){ $this['url'] = Request::url() ."/"; }

In my HTML/TWIG

{{ form_open({ 'files': 'true', 'url': url}) }} {{ form_close}}

@toome123
Copy link

Why you don't use ajax features to send data to server ...

http://octobercms.com/docs/cms/ajax
you can implement the same features with ajax.

or use virtual machine http://www.vagrantup.com/

@sulazix
Copy link

sulazix commented May 7, 2015

I can confirm this issue, can be problematic with fileupload which won't work with {{form_ajax()}} #1112

@daftspunk
Copy link
Member

This is actually caused by your webserver adding the trailing slash because the public path is treated as a directory. This only occurs when the website exists in a subdirectory.

The solution used by @RoySchoep is the best workaround.

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

No branches or pull requests

4 participants