• My site(s) was recently “hacked” by changing the functions.php in the active theme directory. The offending code has been removed, the site(s) have been cleaned and strengthened, and my system scanned.

    One baffling annoyance remains – the wordpress files (and my user files it uses) are in the ‘wordpress’ sub-dir. I’m sure that the original configuration for site was:

    ‘siteurl’,’https://mydomain.com/wordpress’);
    ‘home’, ‘https://mydomain.com’);

    But if I try to set to that using the Dashboard/Settings/General or via the theme functions.php, then I can’t login to the dashboard (‘file not found’). If I change the configuration to:

    ‘siteurl’,’https://mydomain.com’);
    ‘home’, ‘https://mydomain.com’);

    I can login, but not using ‘mydomain.com/wordpress’ as was the case before the troubles, but rather with ‘mydomain.com/wp-login.php’

    Also as a result of this problem, existing links to the user files (e.g., images) are broken – since they want to link to ‘./wordpress/wp-content/…’, but WP now thinks the files are located at ‘./wp-content/…’

    If you wish to see the site in question – it’s https://baystatemarathon.com/
    The theme is Atahualpa.

    I’m sure there’s something trivial wrong, so I apologize for not being able to spot it.

    Any help or pointers are appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You can move the WordPress site under a sub-folder of your website like
    https://domain.com/site”, and set that in the WordPress Address (URL). And keep the index.php in the primary folder.

    So the code at the last line of the index.php:
    require( dirname( __FILE__ ) . ‘/site/wp-blog-header.php’ );

    So that the site will get displayed using https://domain.com/ and you can login to the wp-admin using

    https://domain.com/site/wp-admin

    You can edit the Site URL and Home URL from the Database as well. Go to PHPmyadmin >> Database of your site >> table wp-options >> search the option Site URL and Home URL.

    You can also use any security plugin to rename the wp-admin to something else which you like (e.g https://domain.com/site/test), so the wp-admin will get inaccessible.

    Look at this and work through the examples … you need to copy and move a couple of files and edit the index.php file.

    https://codex.www.ads-software.com/Giving_WordPress_Its_Own_Directory

    Thread Starter glennruns

    (@glennruns)

    Thanks Dan and Radices – I went back though the codex pages related to WP directory structure… (again – and then again).

    I have verified the URL settings per the codex, and I decided to verify the settings in the SQL database (to be sure the changes were taking hold).

    My wordpress subdir is ‘wordpress’ and I have verified the database element ‘siteurl’ is ‘https://baystatemarathon.com/wordpress’ and the database element ‘home’ is ‘https://baystatemarathon.com’.

    With these settings active, I can not “login” to wordpress – I get page not found, regardless if I use ‘https://baystatemarathon.com/wordpress/wp-admin/’ or ‘baystatemarathon.com/wp-admin/’. Further more – element referenced via ‘.wordpress/…’ do not load.

    I re-verified ‘.htacess’ is correct (points to index.php) and that ‘index.php is correct (points to ‘/wordpress/wp-blog-header.php’).

    On the other hand – if I set siteurl to ‘https://baystatemarathon.com’ (regardless of the method – database, functions.php, etc), then I can log in via ‘baystatemarathon.com/wp-admin/’ and the wordpress elements (theme, etc) load, but my user files (e.g. images which were linked with ./wordpress/…) do not load (not suprising).

    Any additional suggestions???

    I guess the alternative is to live with it and change the links to match the new environment (though I suspect more trouble down the road).

    Where is the domain pointed in terms of a folder? Is it the only domain on the hosting package or an add-on domain?

    BTW I manage several Running sites.

    https://girlsgonegazelle.com/
    https://epicdartmouth.com
    https://solesistersrace.com/
    https://lucky7relay.com/

    Cheers,

    Glenn

    Thread Starter glennruns

    (@glennruns)

    Opps – sorry for the delay Radices.

    The site(s) are both IPower sites, pointed at the public_html folder. Beneath that is the wordpress folder. At the level of the wordpress folder are some other folders (mostly left over from the Frontpage days of the website(s)). In the case of our running club (glrr.net) there are some race specific sub-domains, but glrr.net is the top level. In the case of baystatemarathon.com – it is the only domain on that host.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Proper Setting for WordPress in sub-dir’ is closed to new replies.