I am setting wordpress in a custom way and having issues with renaming wp-content. Here are the details:
I am using Amazon AWS as my environment. The default web root is /var/www/html/. Within that directory, I have multiple projects, each having its own directory. So, my WordPress project is in /var/www/html/project01. So this leads to accessing the WordPress from the web browser via the following URL: http://ift.tt/1DWqaXN.
The next step, I typically move WordPress files into a sub-directory. So, I moved all wordpress files into a directory named red inside /var/www/html/project01 then copied index.php from that sub-directory back into the project01 directory, and modified index.php as follows:
require( dirname( __FILE__ ) . '/red/wp-blog-header.php' );
This resulted in the following directory structure:
/var/www/html
|
--------project01
|
-------- index.php /* modified as described above */
|
-------- red
|
-------- wp-config.php
|
-------- wp-content
|
-------- /* Other WordPress files and directories */
So far, everythig works great and without a problem. I can access both the front end and the admin area of the site.
The next step in my setup is to rename wp-content to something else as an added security measure. So, I renamed wp-content to green. So my directory structure now looks like this:
/var/www/html
|
--------project01
|
-------- index.php /* modified as described above */
|
-------- red
|
-------- wp-config.php
|
-------- green /* this is a renamed wp-content directory */
|
-------- /* Other WordPress files and directories */
To complete the directory rename, wp-config.php should be updated to reflect the changes made, so, I followed the instructions described here and added the following to wp-config.php:
define('WP_CONTENT_FOLDERNAME', 'green');
define('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME);
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_CONTENT_URL', WP_SITEURL . 'project01' . '/' . 'red' . '/' . WP_CONTENT_FOLDERNAME);
I added the above code just before the following line in wp-config.php:
require_once(ABSPATH . 'wp-settings.php');
IMPORTANT: Please also note that the WP_CONTENT_URL parameter that I added in wp-config.php is set to include the changes in the directory strucuture described above.
Now, after doing so, if I go to http://ift.tt/1DWqaXN, everything is fine and the site's front-end is displayed properly. However, if I go to http://ift.tt/1DWqcyL to login to the admin area, the page is redirected to http://ift.tt/1EOmAAM as opposed to http://ift.tt/1DWqcyN, and I get a 404 error.
So, my question is, what did I miss? What do I have to do to fix this problem? Is there a setup I have to do in .htaccess for example? Something else? Your help is greatly appreciated.
Thanks.
Aucun commentaire:
Enregistrer un commentaire