October 2, 2008
Much of the headache involved with adding a WordPress blog to an existing BANS site revolves around the re-directions needed, once you move BANS off the domain root. I am hoping I have found a workaround to this and testing continues now! The process was so simple… I actually had a “Pop myself in the Head” moment! If you want to leave BANS where it is and still have your Blog come up as the homepage of your site… read on!
First, you have to understand a bit about the way a webserver works. Anytime someone pulls up yourdomain.com, the server software looks for the index file. It will usually go through a sequence like this:
Depending on your server software, it may go through several of these lookups for index, default, etc etc, until it finds the one that contains your index file.
With BANS, we obviously use index.php to control the functionality of our home directory. Index.php is also heavily rewritten in the htaccess file, so in effect, the index.php is never truly indexed with search engines! ALL of your existing pagerank lies in the / root directory, with no file association at all, thanks to the htaccess mod rewrite.
1 - Login to your cPanel > File Manager > and navigate to the root of your domain, where your BANS Software is currently installed.
2 - In the ROOT of your BANS store, click on Create New File and name the new file: index.htm
There is no need to edit this file at all - it is only being used as a redirect for us. ANY blank file will work, as long as you name it index.htm.
3 - Click one time on your .htaccess file, and from the right side menu, choose edit. We now need to tell ALL visitors that our homepage has moved to the blog directory.
4 - ON THE FIRST LINE of your htaccess file, place the following line: (Replace yourwebsite and /blog, with your site info)
IF this is an Addon Domain - Add this:
redirect 301 /index.htm http://www.yourwebsite.com/blog/
IF This is the MAIN PRIMARY Domain on your Hosting account, Add this:
RewriteCond %{HTTP_HOST} ^(www\.)?yourwebsite\.com
RewriteRule ^index.htm$ http://www.yourwebsite.com/blog [R=301,L,N]
We needed to handle the redirect a bit differently on a MAIN /public_html domain, as the htaccess has a role in ALL you add on domains as well. In this case, we are first asking: Is this yourwebsite.com (Main Domain), if yes, redirect it.
5 - Save the htaccess, close it all up and test your work by typing your domain name into your browser!
We MUST leave the index.php where it is, because as we know, it controls everything that happens on our BANS site. Since we created an index.htm file, the webserver will always try to display it before the index.php file. (You could change this in the server config files, but thats another post)
After we have the index.htm in place, we can simply tell the server and all browsers, through the htaccess file, to redirect it to the blog directory! Every time a search engine or visitor lands on your main domain name, it now automagically redirects to your blog!
Also - since index.php is the file that does control the BANS software, ALL of your existing pages will work just fine!
This is the one section I have not confirmed as of yet… but realistically andlogically, since our index files truly never get indexed in search engines due to the BANS htaccess, the pagerank flows with our / domain name at the root. We are NOT redirecting the root / of our sites in this case, just the index.htm file, therefore ALL existing Pagerank should remain with our BANS root.
If you have any issues… just shoot me an email!
Update for Those that it is not working for
On the VERY TOP LINE of your root htaccess file, you need to instruct apache to use index.html as your default document, before it looks for the index.php. Add the following to your htaccess:
DirectoryIndex index.html index.php
Mark
42 Responses to “Redirecting an Existing BANS Store to your Blog Folder”
Got something to say?
Posting tweet...
Good work Mark. I had some questions about this, thanks.
Wow! Nice work mark.
How does this affect how the blog looks under the BANS template?
Can it be that easy to add a blog to an existing BANS without adversely affecting the indexing and search engine ranking?
@ Steve -
This method ONLY deals with the site redirect… to show your blog page as the homepage.
The themes will still need to be merged together.
Mark
Just tried it on one of my sites, very nice!
Question: I have a few BANS site that got de-index. If I add a blog (in a blog folder) and do the redirect to the blog, will Google pick up on this and re-index the site or will it require some Google groveling on my part.
Bob
@ Bob -
I wish it were that easy…. :-)
Its always worth a try though!
Mark
Question: I have a BANS site and blog with matching templates. (not one of Marks’). How do I link them together? I have looked and looked for an explanation of how to do this but have not found it. I was planning to leave BANS as the root and have the blog in a folder. Can anyone point me in the right direction?
this comes real handy.i have just installed a blog on a bans site and i was thinking that it should be on the root :)
Thanks Mark I really needed this
BG.
@ All -
Please review this post again… Thanks to Jeffleft, I found that there needs to be one extra bit of code if you are redirecting your main domain, versus an addon domain. Both sections of code are relisted above.
If you already added it to an addon domain… no issues or changes at all.
If you added to a MAIN or root domain (The main domain on your hosting account) you will need to make the change referenced above.
Mark
Great work Mark, I really needed help with this.
Your explanation was easy to follow even for a newbie like me.
Thanks,
Victoria
Hey Mark!
This is really cool 8)
I get this to work for:
http://my-diet-program.com/index.htm
but not
http://my-diet-program.com
You mention changes in the server config files - could that be a solution?
@ Thrandur -
Off for sure… but I only tested the most popular configs with HG servers. If you want to shoot me over some cPanel info, I would be happy to look into it.
Mark
Thanks for looking into this, Mark :)
I am running this website on Bluehost, so the settings might be slightly different.
I’m shooting you an email…
@ Thrandur -
It is all set!
in your case with BlueHost, they do not recognize the index.htm as the default sequence of files and instead, looked for index.html (Added the L onto the end)
I changed your index.htm to index.html, and made the needed change to your htaccess to look for …html at the end of the file, and it is all good now!
Mark
WOW - thanks Mark!
Hi Thrandur,
How does one reach from http://my-diet-program.com - which has now become http://my-diet-program.com/blog/ - to the old home page of your BANS store, i.e., http://my-diet-program.com/index.php ?
@ BG -
ALL of your store links are still in your sidebar menu… but if you wanted, you could also add a “Store” link to your main menu, and just point it to the first level of your store:
http://www.my-diet-program.com/Diet/
Mark
Thanks Mark,
BTW Thrandur has not done it, so I got curious… aren’t you practically wasting the very first page of your BANS store (old) by not adding this link in the sidebar?
@ GB -
If you have custom text on your homepage that was optimized and delivering alot of visitors, you may want to turn it into a post or something.
Overall, I think getting BANS off the main landing page of the site outweighs the pain being felt by deindexing, so its really just a personal choice for me.
Old - Static BANS page, with high percentage of duplicate content
New - Very dynamic and constantly changing page, with 100% unique content.
Mark
Hi Mark~
I,ve been trying to follow your steps above; however, I don’t see a .htaccess file under my public_html directory. What am I missing? Or could it be called something else?
I’m using Hostgator, if that matters. Love your site~very helpful.
Thanks in advance.. kim
@ Kim -
In your cPanel > File manager, there is a checkbox in the settings section to show hidden files.
Make sure it is checked to show.
Welcome in also!!
Mark
Great~ found it Mark. Thanks!
One more question: When you type yourwebsite into the code (above) to be placed in that file, am I supposed to put the entire site address from http and the way to .net ?
I’m getting internal server errors.
Thanks for your time helping a real rookie~ Kim
Mark,
You are a genius!! It worked for me.
On another subject….one of my sites has been de-indexed by Google since September. Has there been a post yet about recommended steps to get Google back? Should something be done other than consistently adding content?
Mark,
Do I need to do this if I bought the template from you? I got the template that supports an existing store. It doesn’t seem to work right and we talked before about the problem, but I got sidetracked by the moving stuff we are doing and never fixed it.
Yael
@ Kim -
The code should look identical to the above, with the exception of the “yourwebsite” piece. The http, .coms, all that is already there. Now, if it is a .net site, you would need to change the com to a net.
If its giving you a headache… just shoot me an email and the domain info to look it over.
@ Julie -
I truly wish I had an answer… I think I am on the cusp of getting one of my longtime sites back in, but it has been a 6 month road of constant updates and complete movement of the BANS side of it. I DO intend to write a post abut the experience in the coming days…
@ Yael -
Yes. Regardless of the template, if BANS is on the root and you want it into a folder, you do need to do the forwarding.
Mark
I want to do this for my main site but wondered about if I have to do more redirects of content I redirected originally when I converted the site to BANS WP. There were named domain.com/articlename and I redirected them to domain.com/blog/articlename. Do I need to do ANOTHER set of redirects if I make this change??
Mark,
I love your tutorials man - despite your own beliefs I still believe you’re an awesome teacher!
I can’t remember the last time I followed something you layed out and had the end result be nothing shy of perfect the first time around!
Thanks Elijah!
Now if I can just get myself to finish some of these tutorials… I will be good to go! LOL
I’m curious about whether this is really the same as moving BANS off the root and into a folder… Doesn’t Google etc “know” that its just a redirect, and that really BANS is still in the root?
@ Alice -
Redirecting your homepage is TRULY done for your visitors first… send them RIGHT to the fresh content you update daily first.
As for Google… your BANS index is truly NOT on the root anymore as far as they see it. Your BANS directory may physically be located on the root folder, but all pages are served through your first level content page url. They also know you want people to land on your blog versus your BANS duplicate-content page, which benefits both them and your visitors.
Essentially the ONLY BANS page EVER on the root of a domain as far as search goes, is the main page. EVERY other page is usually in the /store/link directory, which it still is.
Mark,
Did you get my comment that I posted here on this post:
“Redirecting an Existing BANS Store to your Blog Folder”
Or not?
@ GB -
Please resubmit the question - it’s not posted here.
Mark
Hello Mark,
The code given above is not working on my MAIN PRIMARY Domain of my Hosting account as some other redirections are also there on it, like:
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^eye/?$ http://eye.thirdeyehealth.com [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^life/?$ http://life.lifesip.com [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^eyeblog/?$ “http\:\/\/blog\.thirdeyehealth\.com” [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^lifeblog/?$ “http\:\/\/blog\.lifesip\.com” [R=301,L]
What’s the way out, do you know?
Yes Mark,
I have posted the same question third time now, take care in moderation this time.
Thanks.
whoa there dude, you’re out of line. Mark generously and WITHOUT CHARGE provides a valuable service to a big community. If you’re not happy with it, go somewhere else and PAY for someone who will “take care in moderation” just for you!
@ Alice -
Thanks for stickin up for me! :-)
@ GB -
Your sites are not domains, they are subdomains, so it will not work the same (Or possibly at all) for them, in the way it will for a domain itself.
Subdomains are handled in a different way, and may have to be done by Hostgator in the actual DNS, versus simple changes to your htaccess.
Mark
No Mark,
But my MAIN PRIMARY Domain is a proper domain and it is this proper domain that I am talking about!
Alice,
If Mark is offering a service to a community, it’s out of his own volunteering for doing so.
Yes, I do appreciate him (and I do it a lot!) but not blindly!
If in his venture of offering (of his own will) a service he goes off the track, I will be the first man to point out to that.
I appreciate, I don’t flatter.
@GB
What is freely given can be just as easily ungiven. We’re not entitled to endless freebies just because we demand them. Stop whining like a spoiled brat who can’t get to the cookie jar!
Alice,
Nothing is being demanded here. Mark is offering something in order to get a flow of readers to his blog that promotes his business at the end of the day.
And these readers do have a democratic right to comment on his quality of offerings going this way or that, mind it.
In my humble opinion, you are behaving like a fanatic disciple trying to safeguard your cult-figure that you have started worshiping… by now!
@ All -
For anyone having trouble with this after the HG or other server upgrades, add this to the TOP of your root level htaccess file:
DirectoryIndex index.html index.php
Mark
Thanks for the info this is my primary domain in my hosting service i did how is stated above :
RewriteCond %{HTTP_HOST} ^(www\.)?azecorp\.com
RewriteRule ^index.htm$ http://www.azecorp.com/blog [R=301,L,N]
but is not working any help.
Thanks