Need help hiding wordpress directory from google indexing

Hi,
We have a wordpress site that we created and placed in its own directory. We followed the instructions for it on wordpress.org. So it shows up as http://www.mywebsite.com in the browsers but is really located in http://www.mywebsite.com/folder. The problem is that we are doing ad words for this site, with google. We just ran an ad words report and google is indexing http://www.mywebsite.com/folder instead of http://www.mywebsite.com .
How do I get google to index the correct pages without it indexing the directory folder? This is my first time doing a site with ad words. I've looked for a solution online but I am not sure if I am looking in the right place. Please help! Thanks in advance.
rxyl17Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

activematxCommented:
Google will index the absolute path of your pages.  You most likely have a redirect setup in your wordpress installation.

What I would do:

1.  If this domain is primarily used for wordpress re-install wordpress into the root of your domain.
0
rxyl17Author Commented:
Yes, that is right. The root has a redirect to the wordpress directory folder. I figured one solution was to move wordpress to the root of the domain but we always build sites in their own directory for security purposes. Is there any other way to keep wordpress in its own domain and have google index as if it were in the root?
0
GaryCommented:
Why are you using a subfolder if the WP install is running off the root?  Just change the web config to point directly to the folder so you do not have any redirects going on.
What server are you on?
0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

rxyl17Author Commented:
I think I may have explained this wrong. Wordpress is running in the subfolder. I followed this: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory . So it looks to the browser that wordpress is in the root but it is really in the subfolder. So when google indexes it, it indexes the actual location (subfolder). For example it is indexing www.mysite.com/subfolder/about but I want it to index www.mysite.com/about the way it shows up in the browser.
0
GaryCommented:
But since you are running WP from the root you shouldn't even be doing any redirects - you just set up your virtual directory to look directly at that subfolder as the root.
0
rxyl17Author Commented:
I'm confused. This is the site in question: http://craneguys.com and this is what google is indexing (photo attached).google ad words report.
0
GaryCommented:
Of course it is indexing that folder because everything (links) in your site is pointing to it.
Either move your content to the root or change your virtual directory settings so it points directly to that folder and not the root.
0
activematxCommented:
You should have a robots.txt file in your root directory.

Within this file you can tell Google (and other search engines) which directories you do not want indexed.

Here is an example file:

User-agent: *
Disallow: 
Disallow: /cgi-bin/
Disallow: /cgwpsu13zz/

Open in new window


This will tell Google and other search engines to index all of your files except those which fall under /cgi-bin/ and /cgwpsu13zz/

You can add more directories with this syntax:
Disallow: /cgwpsu13zz/

Keep in mind, that any directories added here will not be indexed by GOogle, so will not show up in Google Search results.
0
GaryCommented:
If he blocks that folder it may do more harm than good, Google likes to see how your page looks to the user - and blocking access to it will block all your js, css, images etc.
0
activematxCommented:
If he blocks that folder it may do more harm than good, Google likes to see how your page looks to the user - and blocking access to it will block all your js, css, images etc.

Yes I agree with this.  It will block the folder from search results.  Which is why I really recommend installing wordpress in the root if this is what you are trying to accomplish.
0
rxyl17Author Commented:
Where do I go to change the virtual directory settings?
0
activematxCommented:
I would contact your host.  In-Motion Hosting on how/if they allow you to change a directory into a virtual directory.
0
Jason C. LevineNo oneCommented:
Alternately, just migrate the WordPress install up to the root since that's essentially what you want anyway.
0
Bernard S.CTOCommented:
Just a small caveat: remember that disallow in robots.txt does not say "access to this directory is forbidden" but just "please, be kind enough to not index this directory".

This a 2 consequences:
- well-behaved spiders (Google, Bing, etc) might already have indexed some of these pages and they will remain there; and the spiders may also spider and index some of theses pages when following links from other sites
- evil-behaved spiders will be glad to follow your pointers to "hidden secrets that you can still access".
0
rxyl17Author Commented:
So if I move everything back to the root of the site, what are some things I can do to secure my site? I have read over and over that having wordpress in its own directory is a great security measure. So that is why I usually build sites that way. But if this is not an option for doing the adwords then what other things can I do for security?
0
GaryCommented:
Having it in the root or a subfolder makes no difference as far as security goes.
If it can be hacked it can be hacked wherever it is.
So long as you make sure you harden the installation you should be ok.
http://codex.wordpress.org/Hardening_WordPress
0
activematxCommented:
Having your site in a subfolder or root has no difference.  If I had to guess, I would imagine that most Wordpress installs are done in the root of the server.

Follow the suggestions here:  http://codex.wordpress.org/Hardening_WordPress

If you are really paranoid, you can hire a service such as security metrics or similar to scan your site for vulnerbilities.  There may be free-services similar, if any experts might know.
0
Jason C. LevineNo oneCommented:
I have read over and over that having wordpress in its own directory is a great security measure.

No, it isn't.  Exposing the path is trivial.

As far as hardening goes, the above Codex article is a good start.  I humbly recommend my own for further reading:

http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_10806-Recovering-From-and-Preventing-WordPress-Site-Hacks.html

tl;dr

Use a service like Sucuri to protect your site(s) if you can afford it and plugins like Better WP Security if you cannot.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
marketizeitCommented:
You can easily change the appearance of the directory by using the REWRITE rules in the htaccess file. Here is an example of what you could put in that file:

<ifmodule mod_rewrite.c="">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</ifmodule>

This particular code is saying that the flow goes as follows:

We must first establish that mod_rewrite is available on the server
If so, turn on mod_rewrite
Set the base of all rewriting to the web root folder
If the requested filename isn't a file....
....and it isn't a folder...
Send the person to index.php

You can create different rules for whatever you're trying to do.
0
rxyl17Author Commented:
@marketizeit Does that hide the folder part of the path in all of the pages, images etc.? When I edited the .htaccess file it hid it for the pages themselves but when a person clicks on an image it shows the path of the folder.
0
GaryCommented:
All that code is doing is redirecting to the index.php if a file or folder is not found - absolutely nothing to do with the question.
0
marketizeitCommented:
@GaryC123: I was just introducing the concept of REWRITE - not the exact code.

The actual solution would be something like this:

RewriteEngine On
RewriteRule ^folder/(.+)$ http://www.mywebsite.com/$1 [R=301,L]
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Search Engine Optimization (SEO)

From novice to tech pro — start learning today.