0

I have a WordPress site installed on WPEngine. For the sake of demonstration, let's say its:

https://sub-company.wpengine.com

The site-url of this installation is set to https://company.com/sub-company/

In general this setup is working fine, however form data/submissions (both on the front-end and in the Wordpress Admin) is being sent to https://company.com/ rather than https://company.com/sub-company/. This only occurs when the form action begins with a forward slash:

action="/"

OR

action="/wp-admin/..."

What I want to do is force the data to be sent to https://company.com/sub-company/. My guess is that this is an .htaccess issue, but I'm not quite sure. Any help would be greatly appreciated.

4
  • It's generally advisable in WordPress to use absolute URLs for forms. Mar 20, 2018 at 23:13
  • @JacobPeattie I agree, however many of these URLs are being automatically generated by various plugins (Gravity Forms among others). So I'm wondering if there is some other way of getting this to work.
    – user433351
    Mar 20, 2018 at 23:19
  • You could potentially use .htaccess to force all form submissions (POST requests) that are not to the subdirectory to be routed to the subdirectory. However, this does feel like an ugly workaround. If you want the form to be submitted to the subdirectory, then the forms action should really be set to the subdirectory, not the document root. "My guess is that this is an .htaccess issue" - you make it sound like the problem is caused by .htaccess - it is not. The "issue" is with how the forms are generated. .htaccess could potentially be used as a workaround.
    – MrWhite
    Mar 21, 2018 at 1:22
  • @MrWhite Thanks for your input; that makes sense. I feel like this type of setup (i.e. company.com/sub-company) isn't that uncommon and I've found four plugins that are having this issue to various degrees. I've been able to get working with filters, but others aren't as simple. I feel there must be a relatively "simple" way of getting everything working which is also future-proof (in the sense that the client may add plugins that I cannot currently account for).
    – user433351
    Mar 21, 2018 at 1:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.