# How to hide pages using htaccess

**URL:** <https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025>\
**Category:** RapidWeaver Classic\
**Created:** [May 5, 2018, 4:23pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025 "2018-05-05T16:23:43Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 5, 2018, 4:23pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/1 "2018-05-05T16:23:44Z")

</div>

Hi all :-).

I have now FINALLY loaded my own brand new website here: [http://www.stormdesignprint.com](http://www.stormdesignprint.com).

Now I’m just doing all the backend stuff. I have lots of old files that are no longer valid so I’ve removed them from my server BUT I would also like to stop Google from indexing these old pages. So when I go here: site:www.stormdesignprint.com I can see a list of pages I’d rather not see, so what code do I add for those pages in my htaccess file? Is it that easy?

Many thanks for your time :-).

---

<div class="post-metadata">

**Author:** ![DaveFox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/davefox/32/129_2.png) [@DaveFox](https://forums.realmacsoftware.com/u/DaveFox)\
**Post date:** [May 5, 2018, 4:26pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/2 "2018-05-05T16:26:36Z")

</div>

It’s a robots.txt file you need -[http://www.robotstxt.org/robotstxt.html](http://www.robotstxt.org/robotstxt.html)

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 5, 2018, 4:27pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/3 "2018-05-05T16:27:42Z")

</div>

Hi Dave, I have sitemap plus in my website and I think it generates a robotstxt file, but I’m not sure how to actually use it.

---

<div class="post-metadata">

**Author:** ![swilliam](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/swilliam/32/14799_2.png) [@swilliam](https://forums.realmacsoftware.com/u/swilliam)\
**Post date:** [May 5, 2018, 4:27pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/4 "2018-05-05T16:27:57Z")

</div>

Robots .txt will stop the crawl from new and existing pages but it won’t necessarily remove them from googles index.

You can do it with google webmaster tools though

---

<div class="post-metadata">

**Author:** ![DaveFox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/davefox/32/129_2.png) [@DaveFox](https://forums.realmacsoftware.com/u/DaveFox)\
**Post date:** [May 5, 2018, 5:28pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/5 "2018-05-05T17:28:38Z")

</div>

Apologies - I should have read post properly! Full info here: [https://support.google.com/webmasters/answer/1663419?hl=en](https://support.google.com/webmasters/answer/1663419?hl=en)

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 6, 2018, 12:06pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/6 "2018-05-06T12:06:51Z")

</div>

Ok thanks all, looks like I may as well leave things as they are.

---

<div class="post-metadata">

**Author:** ![joeworkman](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/joeworkman/32/23780_2.png) [@joeworkman](https://forums.realmacsoftware.com/u/joeworkman)\
**Post date:** [May 6, 2018, 8:45pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/7 "2018-05-06T20:45:21Z")

</div>

The robots.txt file will stop search engines from indexing a page initially. However, from my knowledge, if you are linking to that page from any other page that Google indexes, it will eventually get indexed. The only way to guarantee that a search engine does not index a page is to use meta tags directly on the page. Luckily there are settings inside the page inspector in RW7 that will do exactly that.

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 8, 2018, 1:36pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/8 "2018-05-08T13:36:49Z")

</div>

Thanks Joe, but the pages don’t exist anymore in any project so I can’t use the page inspector. They are really old dummy pages that I used when I was creating a site but didn’t want the public to see them. I just noticed that they are still on Google from years ago. Don’t worry I’m sure it’s only me that will be slightly irritated by their presence, nobody else will care.

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [May 8, 2018, 3:49pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/9 "2018-05-08T15:49:27Z")

</div>

The most important thing to do is 301 redirects from the old pages to relevant new ones. Easy to do in cPanel if that’s what you have and should be available in other control panels. More fiddly in htaccess but no major deal. I just did a site:stormdesignprint.com search and there are pages showing 404 not founds - you definitely do not want these. So long as these old pages permanently redirect you are fine with Google.

Google will relegate these pages after a while and, even though they may be possible to find, they will not come anywhere near the first pages of Google results so in practice won’t be seen.

You can also request removal: so long as Google recognises there is no such page (i.e. make sure it has gone from your server) it will be listed for removal. You can do this is in Google Search Console - [https://www.google.com/webmasters/tools/removals](https://www.google.com/webmasters/tools/removals)

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [May 8, 2018, 4:14pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/10 "2018-05-08T16:14:53Z")

</div>

A further thing you need to do in htaccess is decide whether your priority site is “www” or “not www” and set one to divert to the other.

Google effectively sees https:// and [https://www](https://www) as 2 different sites. As you have it now, Google sees these 2 sites and treats one as having duplicate content. This will water down your seo.

which you choose is up to you - there is no inherent benefit for one or the other. If you have always been known as www, it’s on your stationary, and the www version has better ranking, use this. If the other way around, use the non www. If it’s all the same, just choose the one you personally prefer.

Once you have done this, add both versions of the site to your Google Search Console account

Here’s some htaccess code that I use - choose www or non www:

(if RewriteOptions inherit is present, add the force code below it)

#Force non-www:  
RewriteEngine on  
RewriteCond %{HTTP\_HOST} ^[www.stormdesignprint.com](http://www.stormdesignprint.com) [NC]  
RewriteRule ^(.\*)$ [http://stormdesignprint.com/$1](http://stormdesignprint.com/%241) [L,R=301]

#Force www:  
RewriteEngine on  
RewriteCond %{HTTP\_HOST} ^[stormdesignprint.com](http://stormdesignprint.com) [NC]  
RewriteRule ^(.\*)$ [http://www.stormdesignprint.com/$1](http://www.stormdesignprint.com/%241) [L,R=301,NC]

Note - it looks like you already have ‘force https’ in your .htaccess in which case I don’t think you will need https in the above code. You may wish to check this or talk to your hosting engineers about this however

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 9, 2018, 3:10pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/11 "2018-05-09T15:10:49Z")

</div>

Manofdogz thanks for the info. So in that case I’ll have 2 sets of Google tracking id’s in my website rather than one, is that right?

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [May 10, 2018, 11:12pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/12 "2018-05-10T23:12:20Z")

</div>

No - the Google tracking id will be the same for both. Also, in Google Search console, select your preferred ‘canonical’ site and only add a site map for that one.

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 15, 2018, 1:42pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/14 "2018-05-15T13:42:53Z")

</div>

Manofdogs, so I am already using the following code in my htaccess:  
RewriteEngine on  
RewriteCond %{HTTPS} !on  
RewriteRule (.\*) https://%{HTTP\_HOST}%{REQUEST\_URI} [R=301,L]

so are you saying that i need to ALSO add in this code then?  
#Force www:  
RewriteEngine on  
RewriteCond %{HTTP\_HOST} ^[stormdesignprint.com](http://stormdesignprint.com) [NC]  
RewriteRule ^(.\*)$ [https://www.stormdesignprint.com/$1](https://www.stormdesignprint.com/%241) [L,R=301,NC]

They won’t conflict with each other will they?

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 15, 2018, 2:02pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/15 "2018-05-15T14:02:55Z")

</div>

Also I took a look at sorting the canonoical side of things but in my search console it says:  
Use Search Console to specify URLs on one domain as canonical over their counterparts on another domain. For example, [example.com](http://example.com) rather than [www.example.com](http://www.example.com). Use this only when you have two similar sites that differ only by subdomain. Don’t use this for http/https counterpart sites.

so it’s saying not to follow through with that if you are going from http to https, what do you think of this?

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [May 17, 2018, 11:11am UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/16 "2018-05-17T11:11:47Z")

</div>

Should be no conflict but don’t have “RewriteEngine on” twice. Rushing a round at the moment - will try to take a proper look tomorrow / weekend.

---

<div class="post-metadata">

**Author:** ![Gabrielle](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/gabrielle/32/183_2.png) [@Gabrielle](https://forums.realmacsoftware.com/u/Gabrielle)\
**Post date:** [May 24, 2018, 10:59am UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/17 "2018-05-24T10:59:09Z")

</div>

Still getting nowhere with the canonical side of things, it’s confusing. Might leave it.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [June 23, 2018, 8:59pm UTC](https://forums.realmacsoftware.com/t/how-to-hide-pages-using-htaccess/20025/18 "2018-06-23T20:59:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
