Elements Form, missing resources

I created a form (Contact US) with as much of the tipps/suggestions I could find here.
However clicking on the “Submit” (Send this message) button logs this :

Failed to load resource: the server responded with a status of 404 ()
https://www.vps13.org/rw/elements/com.realmac.apipack/api/email

in the browser console.

Which sort of makes sense as there is no “email” (file, directory) in https://www.vps13.org/rw/elements/com.realmac.apipack/api/ .

I tried to publish all (from File menu, etc.) as much as I can, but no “email” in the above path appears.
Any suggestions as to what I maybe missing?

TIA !

Have you chose to send the form by e-mail via SMTP, or to a webhook? And are all settings filled out for it?

Also, maybe check the e-mail field (in case the email part of the path comes from that).

Thanks @Thomas123no, sending the form should results in an email, to the best of my knowledge I filled out/in all fields (I could find).
This is however my first try with the Elements, v0.99, form, so bare with me here …

Would like to help, but not sure what can be going on here.

If you have filled out the SMTP server details, it should send. I guess you’ve checked that the submit button is actually inside the form component? Just in case… And that the button doesn’t have any other click actions.

In Version 0.9.10 also.
The image shows a console error message indicating a failed POST request to a local API endpoint, resulting in a 404 (Not Found) error. (Captioned by AI)

1 Like

Is this the best place to report bugs to the developers?

Hey Ulrich,
Don’t know if it is ‘the best’ place, but yes a number of the RealMac/Elements developers are on here also and regularly give solid feedback.
Which is much appreciated!

1 Like

Hi @Bart-Jan

The reason you’re seeing a 404 for https://www.vps13.org/rw/elements/com.realmac.apipack/api/email is not because there’s supposed to be a physical email file or folder on your server. Instead, the system uses an .htaccess file, which works with Apache’s mod_rewrite module to route any request (like /email, /form, etc.) to a single index.php file behind the scenes.

Think of it like this: you’re making a request to /api/email, and .htaccess says “no matter what the path is, send it to index.php, and let PHP figure out what to do.”

So, if you’re getting a 404, it usually means that the .htaccess file isn’t being read or isn’t working properly (often due to missing server configuration, like AllowOverride All or mod_rewrite not being enabled).

To fix this:

  • Make sure the .htaccess file inside the https://www.vps13.org/rw/elements/com.realmac.apipack/api/ folder is published to the server.
  • Confirm with your hosting provider that .htaccess overrides are allowed, and that mod_rewrite is enabled.

Let me know how you get on, or if you need further explanation as to what’s happening here! :slight_smile:

Hi @Ulrich — see my reply above, could you also check the following:

  • Make sure the .htaccess file inside the https://www.vps13.org/rw/elements/com.realmac.apipack/api/ folder is published to the server.
  • Confirm with your hosting provider that .htaccess overrides are allowed, and that mod_rewrite is enabled.

Thanks! :slight_smile:

Hi ben,

it’s an IIS. So we need a web.config. If i find out how it goes i will post it here.

The public/index.php runs (i added some log messages)
But there are no other messages in the log file.
Maybe i missed some extensions?
PHPInfo: PHP 8.4.10 - phpinfo()

/rw/elements/com.realmac.apipack/api/web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Rewrite to public/index.php" stopProcessing="true">
          <match url="^(.*)$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="public/index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

/rw/elements/com.realmac.apipack/api/public/web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Rewrite to index.php" stopProcessing="true">
          <match url="^(.*)$" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Look here: E-Mail with IIS - how it works