Page 1 of 1
Formbuilder: form not working on homepage
Posted: Mon May 11, 2015 11:59 am
by oscarcookie
I use a basic form in one of my templates.
If the form is submitted on a subpage, everything works fine, if it is submitted on the homepage, nothing happens.
I am clueless. Any thoughts?
The form can be found on the bottom right of the page
homepage:
www.myanmarreizen.be (or accessed through
www.myanmarreizen.be/myanmar/home -> gives the same non-result)
subpage with same template:
www.myanmarreizen.be/test (or
www.myanmarreizen.be/myanmar/test) -> works fine, form is sent, user is redirected.
Thanks in advance,
Oscar
Re: Formbuilder: form not working on homepage
Posted: Mon May 11, 2015 11:06 pm
by Dr.CSS
The test page has the correct action URL the home page doesn't...
action="
http://www.myanmarreizen.be/test"
Home page, even though the address bar says myanmar/ ...
action="
http://www.myanmarreizen.be/"
So it's sending it to a different page...
Viewing the page source is a wonderful thing

...
Re: Formbuilder: form not working on homepage
Posted: Tue May 12, 2015 6:47 am
by oscarcookie
Thanks! This is probably due to .htaccess settings I guess...
Any thoughts on how to fix it? The form _is_ created by formbuilder, and afaik there is no way to modify the action URL manually...
This is the .htaccess of the myanmar folder:
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myanmar/
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
This is the .htaccess of the root:
Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} myanmarreizen\.be$ [NC]
RewriteRule ^$ http://www.myanmarreizen.be/myanmar [L]
RewriteCond %{HTTP_HOST} ^(www\.)?myanmarreizen.be$
RewriteCond %{REQUEST_URI} !^/reisconfig.*
RewriteRule !^myanmar/ myanmar%{REQUEST_URI} [L]
RewriteCond %{HTTP_HOST} ^(www\.)?myanmarreizen.be$
RewriteCond %{REQUEST_URI} !^/reisconfig.*
RewriteRule ^myanmar/(.*)$ /$1 [L]
Re: Formbuilder: form not working on homepage
Posted: Tue May 12, 2015 7:08 am
by oscarcookie
Adding this to the top of the root .htaccess solved the problem:
Code: Select all
RewriteCond %{REQUEST_METHOD} =POST
RewriteRule ^ - [L]
... and it broke the CMSMS forms (eg when changing the template of the formbuilder)
Any .htaccess experts in the room?
Re: Formbuilder: form not working on homepage
Posted: Tue May 12, 2015 8:15 am
by velden
Try to use
Code: Select all
RewriteCond %{REQUEST_METHOD} !POST$
as a condition for every rewrite_rule. If you're using all those conditions/rules you'd better know how things work out in my opinion.
Re: Formbuilder: form not working on homepage
Posted: Tue May 12, 2015 8:27 am
by oscarcookie
Thanks for your reply!!
I've changed accordingly, but still get "The requested URL was not found on this server."
http://www.myanmarreizen.be/admin/moduleinterface.php
root .htaccess looks like:
Code: Select all
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !POST$
RewriteCond %{HTTP_HOST} myanmarreizen\.be$ [NC]
RewriteRule ^$ http://www.myanmarreizen.be/myanmar [L,QSA]
RewriteCond %{REQUEST_METHOD} !POST$
RewriteCond %{HTTP_HOST} ^(www\.)?myanmarreizen.be$
RewriteCond %{REQUEST_URI} !^/reisconfig.*
RewriteRule !^myanmar/ myanmar%{REQUEST_URI} [L,QSA]
RewriteCond %{REQUEST_METHOD} !POST$
RewriteCond %{HTTP_HOST} ^(www\.)?myanmarreizen.be$
RewriteCond %{REQUEST_URI} !^/reisconfig.*
RewriteRule ^myanmar/(.*)$ /$1 [L,QSA]
myanmar .htaccess looks like:
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /myanmar/
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_METHOD} !POST$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
Re: Formbuilder: form not working on homepage
Posted: Tue May 12, 2015 8:41 am
by velden
If I understand your code correctly you're trying to have the home page have the 'myanmar' at the end of the url?
You might consider using another approach but I'm not sure if that's working out well either technically and SEO wise.
Create a dummy home page and hide it from the menu, make it the default page.
Change the alias of the current homepage to 'myanmar' if not already done so.
Clean up your .htaccess
Create a rewrite rule with a REDIRECT from root url to the 'myanmar' page. I
think a
http 301 redirect is best option SEO wise. Probably it will make search engines index the /myanmar page and not the root url.
Re: Formbuilder: form not working on homepage
Posted: Tue May 12, 2015 11:10 am
by oscarcookie
Good suggestion, thanks... By trying to do this, I cleaned up the .htaccess, and solved the entire problem
It appeared that
Code: Select all
RewriteCond %{REQUEST_METHOD} !POST$
RewriteCond %{HTTP_HOST} myanmarreizen\.be$ [NC]
RewriteRule ^$ http://www.myanmarreizen.be/myanmar [L,QSA]
was completely unnecessary.
Thanks for your help guys, CMSMS rocks
Re: Formbuilder: form not working on homepage
Posted: Wed May 13, 2015 1:16 am
by Dr.CSS
When using RewriteBase / the folder name you put there is not supposed to have the / at the end of it...
Re: Formbuilder: form not working on homepage
Posted: Mon May 18, 2015 6:53 am
by oscarcookie
Thanks Dr.Css! Completely right!