Website being displayed in root and subdirectory - wordpress

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!

Related

How to redirect wordpress (installed inner directory) to main root address?

I've installed wordpress into a inner directory. like root/mysite . Why I didn't install it on root because there are so many addon domain installed, and I literally don't want to mess all addon domain folders with wordpress files inside root directory. My root directory is for www.example.com . And my wordpress site I've installed on root/mysite, so the url for that is www.example.com/mysites . Is there anyway to redirect www.example.com/mysites to www.example.com . As I said the only reason for not installing wordpress on my root, because I don't want to mess wordpress files, folders with other addon domain's folders on root.
So my main goal is showing a wordpress site on www.jimfahad.com that is installed on www.example.com/mysites. Is there any way?
Yes, you can leave the WordPress install and folders in mysites, but you have to copy the .htaccessfile and the index.php file to root. This will result in the visual URL of WordPress being in root (example.com), but the uploads, theme URLs, etc, being in example.com/mysites.
See the WordPress Codex > Giving WordPress Its Own Directory « Using a pre-existing subdirectory install on how to copy and edit the files:
1) Go to the General settings panel.
2) In the box for Site address (URL): change the address to the root
directory's URL. Example: http://example.com
3) Click Save Changes. (Do not worry about the error message and do
not try to see your blog at this point! You will probably get a
message about file not found.)
4) Copy (NOT MOVE!) the index.php and .htaccess files from the
WordPress (wordpress in our example) directory into the root directory
of your site—the latter is probably named something like www or
public_html. The .htaccess file is invisible, so you may have to set
your FTP client to show hidden files. If you are not using pretty
permalinks, then you may not have a .htaccess file. If you are running
WordPress on a Windows (IIS) server and are using pretty permalinks,
you'll have a web.config rather than a .htaccess file in your
WordPress directory.
5) Edit your root directory's index.php:
6) Open your root directory's index.php file in a text editor. Change
the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name for the WordPress core
files:
require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );
and save the file.
7) Login to your site (if you aren't still already). The URL should
still be http://example.com/wordpress/wp-admin/
8) If you have set up Permalinks, go to the Permalinks panel and
update your Permalink structure. WordPress will automatically update
your .htaccess file if it has the appropriate file permissions. If
WordPress can't write to your .htaccess file, it will display the new
rewrite rules to you, which you should manually copy into your
.htaccess file (in the same directory as the main index.php file.)

Migrate wordpress site from subfolder to root, remove static page

My website have structure like this:
In root domain I have static html page "portfolio" (which I won't need it anymore, becauose I'll create it in wordpress):
http://www.natasamedvesek.com/
and I have installed wordpress for blog in subdirectory:
"natasamedvesek.com/blog/"
Now I have also all my pages structured like this "/blog/about" , "/blog/info" .... .
Now I'm asking what to do:
(1) move wordpress instalation from subdirectory "blog" to root directory.
or
(1) leave wordpress instalation as it is, in subdirectory "blog" and create redirect 301
My new structure would look like this:
"natasamedvesek.com" ---> portfolio "natasamedvesek.com/about" ---->
page "about" "natasamedvesek.com/info" ----> page "info" . . .
"natasamedvesek.com/blog/" ---> page of postsIt's very important that I won't lost all my existing likes and shares from facebook, from all of my posts? What about my existing rank for SEO on google?
If I do create redirect 301, what I have to do?
Is this correct way, if I would put this code in .htaccess file
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.natasamedvesek.COM/$1 [R=301,L]
Thanks for answers
It's much easier than using redirects; you can use the pre-existing subdirectory install and have admin at /blog/ while root appears to be at root.
From Giving WordPress Its Own Directory « Using a pre-existing subdirectory install
1) Go to the General panel.
2) In the box for Site address (URL): change the address to the root directory's URL http://www.natasamedvesek.com
3) Click Save Changes. (Do not worry about the error message and do not try to see your site at this point).
4) Copy (NOT MOVE!) the index.php and .htaccess files from the blog directory into the root directory of your site.
5) Edit your root directory's index.php. Open your root directory's index.php file in a text editor. Change the line that says:
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
to the following, using your directory name for the WordPress core files:
require( dirname( __FILE__ ) . '/blog/wp-blog-header.php' );
and save the file.
6) Login to your site (if you aren't still already). The admin URL should still be http://www.natasamedvesek.com/blog/wp-admin/
7) If you have set up Permalinks, go to the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)
very important that I won't lost all my existing likes and shares from
facebook...
You will lose your Facebook shares because the URL is changing, and there is no way to change an incoming Facebook link. And your SEO will take a temporary hit because you are changing URLs, at least until Google reindexes the site.

Move wordpress to root

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/

Blank Page Encountered When Moved Wp-content Directory Outside

I'm trying to install Wordpress with clean subversion repositories, as in http://codex.wordpress.org/Installing_WordPress_With_Clean_Subversion_Repositories. I have followed every step accordingly until the second last step, where it says 'You should now be able to view the site via the root URL (http://example.com)', and indeed I can see my website on, say, http://example.com.
Once I go to the final step of changing the wp-config.php though, http://example.com draws a blank page. I am quite sure the wp-config.php is the problem, i.e. Wordpress doesn't know that it should retrieve my wp-content contents from outside the core Wordpress directory. My directory structure is as such:
.htaccess
core/
custom/
wp-config.php
, where core/ holds the files checked out with Subversion, custom/ holds my themes/ and plugins/ directory, and wp-config.php contains the below lines:
define('WP_CONTENT_DIR', dirname(__FILE__) . '/custom');
define('WP_CONTENT_URL', 'http://example.com/custom');
I have tried other variations, like:
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/custom');
define('WP_CONTENT_URL', 'http://example.com/custom');
I have also tried hardcoding the local path, like:
define('WP_CONTENT_DIR', '/home/MYUSERNAME/example.com/custom');
define('WP_CONTENT_URL', 'http://example.com/custom');
, but none of the above works. Then I renamed the custom/ folder to wp-content/, but again nothing. I even went into Dreamhost to prevent redirecting http://example.com to http://www.example.com and vice versa, but again to no avail. I don't believe core/ is the problem, because I can access the Dashboard via http://example.com/core/wp-login.php, and the Dashboard says it can't detect my themes, which confirms my suspicion that WP doesn't know to retrieve the files from the custom/ folder.
By now, I have run out of ideas as to where could the problem be. Can anyone experienced in this area please give me some advice? Thanks a million.
Ensure that your statements come BEFORE the call for wp-settings.php, which is usually around line 90. Wp-settings (or more accurately default-constants.php) checks if the paths and URLs have already been defined, so you want to make sure you define them beforehand.
If that isn't the issue then check if $_SERVER['DOCUMENT_ROOT'] is returning the values you expect; you might have issues if working in a sub-directory.

Bitnami Stack : accessing wordpress installation in its own directory at domain root

Please Bear With Me!!
i am using this tutorial Giving Wordpress Its Own Directory (Using a pre-existing subdirectory install part ) to launch a wordpress (installed at a sub folder called wordpress) by using example.com instead of example.com/wordpress.
Now it says that copy index.php to your root folder and change the relative path to wp-blog-header.php accordingly now by folder structure is a little complex hence i have attached a pic
Now to access site root i go to example.com(obvious)
but to access wordpress i have to go to example.com/wordpress (if anyone wondering why i am using bitnami wordpress stack AMI and thus everything came preconfigured)
now accoringly to tutorial i should copy index.php to site root from wordpress root and change relative location of wp-blog-header.php accordingly.
when index.php was in same directory the function was require('./wp-blog-header.php') . Now this location is to be changed
I have tried all three options i could think of (i guess)
1) ../apps/wordpress/htdocs/wp-blog-header.php
2)./wordpress/htdocs/wp-blog-header.php
3)wordpress/htdocs/wp-blog-header.php
Edit : its a bitmani wordpress stack ami on amazon aws and its the reason i believe there is problem in the first place.
But visiting the domain root gives server error . Any suggesstions??
Try require ( $_SERVER['DOCUMENT_ROOT'] . '/wherever/wp-blog-header.php/is/located and it should find it.
Here is the answer http://wiki.bitnami.org/Components/Apache#How_to_change_the_URL.3f
it was because of bitnami and not a fault of wordpress

Resources