Move wordpress to root - wordpress

A friend of mine asked me to help him to move his website from website.com/wp to the root website.com/
Its Wordpress installation is automatized by some script on register.it
I followed this guide, I log on, I changed both WordPress and Site Address from website.com/wp to website.com and saved.
Then from the ftp, I copied and pasted all my public/www/wp one step higher to public/www/ but the site was down and I couldn't even reach website.com/wp-admin or website.com/wp-login.php
Then I restored one of the backups I had and I tried this other guide, I moved the index.php one step higher by changing
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );
And of course this didn't work neither..
Now I start also wondering if that one was the real Wordpress root, this is the structure
How can I make the website be reachable on the root?

I solved it.
I tried the whole time playing with the /public/www folder, while instead the real Wordpress root was under /web/

Related

I moved wp site from server to local host but i cant run it now

I moved a wp website from server to local host and i run it successfully in first time. But now i wanted to move the same website with new content then i just replaced the DB and wp files in the previous folder but now i cant run the website it shows the below error (download file)
once i try : localhost/8888/websitename
it downloads a file with following scripts:
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* #package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* #var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
This may be a plugin or theme conflict. Please attempt to disable all plugins(by rename plugins folder), and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.
And this issue also cause by wrong code in .htaccess file. So, please check that too.
The problem could be caused by using invalid/incorrect php/php.ini handler .htaccess code in the root .htaccess file.
This was my problem.
There could have been a php/php.ini handler code in the wp-admin .htaccess file when the wp-admin .htaccess file should not have any php/php.ini handler code in it.
The php/php.ini handler .htaccess code should only be in the root .htaccess file. If that was the case I would have tried deleting the wp-admin .htaccess file and see if that solved the problem.
There could be a .htaccess file higher up in the hosting account folder structure that has invalid php/php.ini handler .htaccess code in it.
That is what I originally checked for in step 1.
Another problem could be that the hosting provider was upgraded and not configured correctly.
I think this shouldn’t be your first conclusion.
There are a couple other reasons why you may have run into this problem, but I think this is a good start to troubleshooting the problem

How to redirect WordPress blog page to root path?

I setup WordPress in our server's different folder so url look like domain.com/wordpress
Then I created blog page so my blog url look like do domain.com/wordpress/blog
Now i try to change domain.com/wordpress/blog to domain.com/blog.
The general approach to running WordPress from a subdirectory is as follows:
1) Under Settings > General, set WordPress address (URL) to:
domain.com/wordpress
This is the actual location of your WordPress installation. Also set Site address (URL) to:
domain.com
This is what you want the user to enter to get to your site. Save the changes.
2) Copy the .htaccess and index.php files from your WordPress directory into your root directory. Edit the index.php file and change:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
This sends connection requests to the correct directory.
3) Login to your WordPress admin, which should be at domain.com/wordpress/wp-admin/. Go to Settings > Permalinks and click Save. This will update your permalinks.
You should now be running the way you wanted.

Can somebody tell me the difference between these two parts of codes

I'm trying to read wordpress codes to have a deep insight about how things work, and also because I need to put my hand into it for special reasons, but I got stuck in this, hope some of you guys can explain the difference between these for me:
if ( file_exists( ABSPATH . 'wp-config.php') )
and
if ( file_exists( dirname(ABSPATH) . '/wp-config.php' )
Many thanks
Assuming you're looking at wp-load.php, these pieces of code do what their associated comments say:
if ( file_exists( ABSPATH . 'wp-config.php') ) {
/** The config file resides in ABSPATH */
require_once( ABSPATH . 'wp-config.php' );
} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
/** The config file resides one level above ABSPATH but is not part of another install */
require_once( dirname(ABSPATH) . '/wp-config.php' );
That is, they're trying to find the wp-config.php file.
As described in Hardening WordPress, one option you have for increasing the security of your WordPress installation is to move your wp-config.php file one level above the root of your WordPress installation. This is because you can then configure your web sever not to serve any files above the standard WordPress root (where index.php lives, so has to be accessible from the web.) That makes it a little less likely that someone can see the content of your wp-config.php, which has important things like your database password in it.
So, given that:
Note that wp-config.php can be stored ONE directory level above the WordPress (where wp-includes resides) installation. Also, make sure that only you (and the web server) can read this file (it generally means a 400 or 440 permission).
...WordPress uses the code you're seeing to first check if there's a wp-config.php file at the absolute path of your WordPress installation, i.e. your root WordPress directory, ABSPATH, but if there isn't, it uses the dirname method to go one step up, by checking for a wp-config.php file in the directory that contains the root WordPress directory.

Website being displayed in root and subdirectory

My website is being displayed at two locations: one in the root like www.website.com like I want it to, and the other is displayed at www.website.com/wordpress, which I don't want.
In the folder structure of my website, I installed WordPress in a subdirectory called wordpress, copied the index.php file to the root, and amended this to make it point at the subdirectory: require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
Is this normal behaviour, and can I somehow have my website be display only at www.website.com?
I just spun up a development instance, and tried going through the process, and I got the same result. I was able to fix it by renaming the index.php that is NOT in the root to useless.php. That made the /wordpress portion of the site 503, and it kept the root portion of the site running. Try it and let me know if it works!

wordpress change themes location

Usually all the wordpress themes are uploaded and saved over the server say http://example.com/wp-content/themes/ . I am developing a plug-in to change this path to something like http://xyz.com/themeFolder/ . So i have to develop such a functionality where my wordpress installation will be on one server and the themes and plug-ins folders will be on another server.
Any help, will be highly appreciated.
Thanks in advance to all the genius people out there :)
Since Version 2.6, you can move the wp-content directory, which holds your themes, plugins, and uploads, outside of the WordPress application directory.
Set WP_CONTENT_DIR to the full local path of this directory (no trailing slash), e.g.
define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );
Set WP_CONTENT_URL to the full URI of this directory (no trailing slash), e.g.
define( 'WP_CONTENT_URL', 'http://example/blog/wp-content');
SOURCE
Do not forget to check THIS page as well.

Resources