简体   繁体   中英

Wordpress - I can reach by url normal php files but no uploaded ones

I'm working on a Wordpress project, and I'm trying to create a product via woocommerce rest API, I made it work in local, but when I upload the files to the server, I just can't reach via URL my file, for example, If I write:

    $.get('http://example.com/wp-includes/option.php')
    .done(function() {
        alert('Correct');
    }).fail(function() {
        alert('Nope');
})

An alert with Correct appears, but, if I write:

    $.get('http://example.com/wp-includes/createProduct.php')
    .done(function() {
        alert('Correct');
    }).fail(function() {
        alert('Nope');
})

An alert with Nope will be shown, so I don't get why it reaches all its 'native' files and not that one I uploaded. Files like .js in the js folder are being read correctly, but this .php just can't be reached. And I need it for an AJAX :c

Hope someone can help me and thanks.

Check your directory/file permissions.

On linux try running ll -h inside the wp-includes directory to compare the user and read/write permissions of the files being created.

For instance, you may be user ubuntu, ec2-user, something like that, but your files are being created and owned by root.

EDIT:

Upload your files through cpanel's file manager.

Whether I upload the file using winscp or cpanel file manager, it doesn't affect the read/write permissions, it's always 0644, which should work. BUT uploading through cpanel's file manager, the ownership for the file is the same where as using winscp to upload the user is different.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM