Welcome to WebmasterWorld Guest from 54.145.39.186

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Wordpress on Root and Subdirectory

Wordpress on Root and Subdirectory

     

Love2Blog

9:18 pm on Jul 17, 2011 (gmt 0)

5+ Year Member



My software is outdated, BANS, and I want to switch to Wordpress on the root of the site, so, widgets.com

but this site allready has Wordpress on a subdirectory that is thriving and ranking, widgets.com/blog

The root of the site is more geared towards products and shopping, while the blog on the subdirectory is for the majority of the content.

Anybody know of any issues with having Wordpress twice in root and subdirectory?

Thanks

lorax

10:45 pm on Jul 17, 2011 (gmt 0)

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I suspect there'll be no issues as long as you use clearly separate logins and databases. Modify your Salts to be unique and such as well and you should be fine.

g1smd

10:49 pm on Jul 17, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



You'll need to combine the .htaccess files and add folder exclusions to one of the rules otherwise all URL requests will be rewritten to the PHP script in the root installation.

Love2Blog

11:30 pm on Jul 17, 2011 (gmt 0)

5+ Year Member



I suspect there'll be no issues as long as you use clearly separate logins and databases. Modify your Salts to be unique and such as well and you should be fine.


Yes they are two completely different installs of Wordpress, 2 databases and two logins.

What are Salts?

thank You

You'll need to combine the .htaccess files and add folder exclusions to one of the rules otherwise all URL requests will be rewritten to the PHP script in the root installation.


Oh so I can't just use two separate .htaccess? That is how it is set up now, each folder, root and sub has its own

Thank You

g1smd

11:38 pm on Jul 17, 2011 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The root .htaccess file rules will capture requests that are meant for the folder.

Love2Blog

12:01 am on Jul 18, 2011 (gmt 0)

5+ Year Member



The root .htaccess file rules will capture requests that are meant for the folder.


Oh okay, I will fix it, anyplace I can find an easy guide or tutorial, or my host should be able to help right, though sometimes idiots answer the phone

lorax

1:20 pm on Jul 18, 2011 (gmt 0)

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The salts are in the wp-config.php file. 8 of them should be there.

define('AUTH_KEY',  '');
define('SECURE_AUTH_KEY', '');
define('LOGGED_IN_KEY', '');
define('NONCE_KEY', '');
define('AUTH_SALT', '');
define('SECURE_AUTH_SALT', '');
define('LOGGED_IN_SALT', '');
define('NONCE_SALT', '');

rocknbil

3:40 pm on Jul 21, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Is there some reason you can't use the Pages function of your current install for the root pages of the site, leaving your blog at /blog?

lorax

4:46 pm on Jul 21, 2011 (gmt 0)

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



That's a good question RB.

My guess is the answer lies in a fear of losing rankings. I suspect they may take a brief dip but would likely come back even stronger afterward providing all of the necessary details are handled.

Love2Blog

5:04 pm on Jul 21, 2011 (gmt 0)

5+ Year Member



Is there some reason you can't use the Pages function of your current install for the root pages of the site, leaving your blog at /blog?


You know what, I never even thought of that. But as Lorax said, I probably would not have done that to maintain the same site structure for rankings, the site root ranks very well. As it was I spent hours manually doing permalinks and such to keep it all the same.

But, it's all done now and everything is working properly, hopefully the rankings hold.

For anyone else reading this thread who needs to know, I used separate htaaccess files, one sits at the root and the other at the subdirectory.

As a php expert informed me:
WordPress's .htaccess includes an exclusionary rule -- the 2 Rewrite conditions that have the -f and -d -- those mean "if it's not a file, and it's not a directory, then use this rule." So in theory, the one in the root would not affect the one in the blog subdirectory, because your blog subdirectory is a directory.

So here is the standard code that works for both htaacess files in both the root and subdirectory (this is just the standard hta that comes with wordpress)

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


# END WordPress

Love2Blog

5:05 pm on Jul 21, 2011 (gmt 0)

5+ Year Member



Thanks everyone for your input, it's always nice to get information from a trusted source.

rocknbil

4:46 pm on Jul 22, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



but this site allready has Wordpress on a subdirectory that is thriving and ranking, widgets.com/blog


It so happens I'm working on a site today with this exact same structure. :-) Your blog posts and URL's wouldn't change at all. You just create a page with the URL /blog that duplicates your blog index.

You'd also have to change your "home page" in the WP settings.

You can do a no-risk test of this right now - create a test page in WP and browse to it. It will be the basis of the rest of your work, and can change out pages one by one. If you're using .html extensions on your current pages, just redirect them to the new one in .htaccess:

ReWriteRule ^test\.html$ /test [R=301,L]

The 301 will appropriately redirect SE's with no loss in any ranking you may have. It just doesn't make a lot of sense to have two databases to maintain.

As for that .htaccess code, which is used by almost all CMS's everywhere, after having been slapped about many times by a awesome member here :-) , it's horribly inefficient. It searches the entire file system twice, which gets to be very intensive when your site gets large. I've actually seen drastic improvements just by changing it to something like this:

# BEGIN WordPress
#intensively inefficient
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /index.php [L]
# END WordPress

RewriteCond %{REQUEST_URI} !^\/*wp\-admin\/*$
RewriteRule ^([^.]+)$ /index.php [L,QSA]

In your case, you'd probably need

RewriteRule ^([^.]+)$ /blog/index.php [L,QSA]

The # are comments, and I recommend leaving them in for anyone stumbling on it and wanting to set it back.

What's the difference? It says "if the request is NOT wp-admin and it does NOT have a dot somewhere, redirect to index.php." You'll never have files without a dot for the extension. This allows normal acces to all images, etc. , it works perfectly . . . .however if you have any subdomains in the same directory (though don't know why you would) it may require a different approach.

It also may need some tweaking if you have any openly browseable directories like /images/. Though you probably shouldn't.

Give it a try, the result may appear the same but it's better.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month