SEO and .htaccess question, anyone?

3 replies
  • SEO
  • |
The standard .htaccess file in cpanel looks like this:

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


However, I have to add this code in order to de-index all PDFs:

<FilesMatch "\.pdf$">
header set x-robots-tag: noindex
</FilesMatch>


My question is do I add my new code between those above <IfModule mod_rewrite.c> tags or create new ones i.e. <IfModule mod_headers.c>

If anyone even has an idea, thanks.
#htaccess #question #seo
  • Profile picture of the author paulgl
    There is no guarantee of a deindex, unless you take them offline, or put them
    behind a password.

    Rewrites go last. I'm guessing that you would put it first.

    Normally, you do the most specific first, then in descending to more general,
    but in groups of the same type. And since you do access rules first, it
    also fits to put it first. Although, that's not really an access rule.

    You could try it in both places and see if it actually matters.

    You could make it an access rule.

    If you have a small number of pdfs, you could do it manually.

    Paul
    Signature

    If you were disappointed in your results today, lower your standards tomorrow.

    {{ DiscussionBoard.errors[9064909].message }}
  • Profile picture of the author yukon
    Banned
    Why bother writing the .htaccess code when all you have to do is go to the HG/Cpanel & block the filetype from there? HG/Cpanel will write the code for you & add the same code to the .htaccess file.

    Yes, Google will remove the filtype when blocking in the .htaccess, I did it for a single image type (png), it's no different than blocking any other filetype.

    Keep in mind Google won't block the filetype until, they find the code your using to block the filetype, so Google has to crawl the .htaccess file before they'll even attempt to block anything.
    {{ DiscussionBoard.errors[9065631].message }}
  • Profile picture of the author Tim3
    Also if your PDF's are already indexed, you may also want to use your Webmaster Tools and submit a URL removal request, which usually happens within a day or two.
    Signature

    {{ DiscussionBoard.errors[9068271].message }}

Trending Topics