If this is the wrong place for this let me know.

I have a wp site I am trying to set up on localhost for dev that uses ajax requests that resolve to root (/).

The problem I have is that the requests are being interpreted as http://localhost/user/ not http://localhost/public_html because of the extra folder in the structure.

Original site:

domain > public_html > wpinstall

However in my local and shared hosts it is:

domain > user > public_html > wpinstall

This means roots child is user not public_html like it needs to be and the site 404's.

Does anyone have a solution?

  • you are doing ajax wrong. fix your code to use proper wordpress ajax api Apr 28, 2017 at 7:26
  • I didnt write it i'm taking the site over, hence the issues.
    – JPB
    Apr 28, 2017 at 12:43

1 Answer 1


Add these two lines to the bottom of your wp-config.php. Right above the line that says to stop editing.

define( 'WP_HOME' , 'http://localhost/public_html' ); define( 'WP_SITEURL' , 'http://localhost/public_html' );

  • @JPB Please accept my answer if it solved your problem. Thanks
    – Joe Dooley
    Apr 29, 2017 at 0:21
  • Hi mate. It was late evening my time when you posted. Just got up will be testing later asap. Fingers crossed.
    – JPB
    Apr 29, 2017 at 0:36
  • Unfortunantely this was not the solution as I already had this in General settings. It appears I need a redirect to append /public_html to /
    – JPB
    Apr 30, 2017 at 5:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.