Formbuilder: form not working on homepage

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
oscarcookie
Forum Members
Forum Members
Posts: 13
Joined: Thu Apr 01, 2010 9:46 am

Formbuilder: form not working on homepage

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Formbuilder: form not working on homepage

Post 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 ;)...
oscarcookie
Forum Members
Forum Members
Posts: 13
Joined: Thu Apr 01, 2010 9:46 am

Re: Formbuilder: form not working on homepage

Post 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]
oscarcookie
Forum Members
Forum Members
Posts: 13
Joined: Thu Apr 01, 2010 9:46 am

Re: Formbuilder: form not working on homepage

Post 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?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Formbuilder: form not working on homepage

Post 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.
oscarcookie
Forum Members
Forum Members
Posts: 13
Joined: Thu Apr 01, 2010 9:46 am

Re: Formbuilder: form not working on homepage

Post 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>
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Formbuilder: form not working on homepage

Post 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.
oscarcookie
Forum Members
Forum Members
Posts: 13
Joined: Thu Apr 01, 2010 9:46 am

Re: Formbuilder: form not working on homepage

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Formbuilder: form not working on homepage

Post by Dr.CSS »

When using RewriteBase / the folder name you put there is not supposed to have the / at the end of it...
oscarcookie
Forum Members
Forum Members
Posts: 13
Joined: Thu Apr 01, 2010 9:46 am

Re: Formbuilder: form not working on homepage

Post by oscarcookie »

Thanks Dr.Css! Completely right!
Post Reply

Return to “Modules/Add-Ons”