Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I've just completed a Couch CMS website and published it. I've turned pretty URLs on and added the generated .htaccess file and everything still works fine except my form which now gives a 404 error. I removed the .htaccess file but still get the error so it seems to be caused by pretty URLs turned on.

Here is the opening tag of the form:
Code: Select all
<form id='postform' method="post" action="check.php" enctype='multipart/form-data'>


So I think Pretty URLs must be blocking the "check.php" page. Is there a way to add an exception for this page perhaps?

Thanks for any help.

Hi,

A couple of questions -
1. The PHP file containing the <form> code, is it a Couch managed template?
2. The 'check.php' in the action parameter, is that a Couch managed template?

Please let me know.
Thanks.

Hey KK,

Yes the PHP file containing the <form> is a Couch managed template. I only need an editable region above the <form> so I could place the
Code: Select all
<?php COUCH::invoke(); ?>
above that if that's the best option.

The check.php isn't Couch managed.

Thanks.

OK, so I guess this is what is happening -
since the host template is Couch managed, when prettyURLs are turned on, its URL loses the '.php' e.g. if the template is, say, 'contact-us.php', the URL will now turn up as http://yoursite.com/contact-us/.

Please note above that from the look of the URL, it appears as if 'contact-us' is a folder. So, when the form gets submitted, its 'action' being a relative URL 'check.php', gets converted by the browser into 'http://yoursite.com/contact-us/check.php'.

I think you can see from the resulting URL that no such page as 'contact-us/check.php' exists and ergo the '404 Not found' error.

To rectify the problem, you simply need to use the fully-qualified URL of check.php. You can try the following -
<form id='postform' method="post" action="<cms:show k_site_link />check.php" enctype='multipart/form-data'>

If you do a view-source of the page, you should find the 'action' parameter containing a full URL. Please ensure it points correctly to check.php and that should do it.

Hope it helps.

That fixed it up! Thanks mate your a legend! Sites 100% now :)
5 posts Page 1 of 1