CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   htaccess restricting access to robots.txt (http://www.codingforums.com/showthread.php?t=267513)

Dannyeo 07-10-2012 09:31 AM

htaccess restricting access to robots.txt
 
Hi there,

I'm hoping that someone may be able to help me.

I believe my htaccess file is restricting access to my robots.txt file and would like to add an exception to the htaccess to enable search engines to find the file.

Does anyone have any thoughts on how to achieve this?

The code in my current htaccess file is:

Code:

<IfModule mod_rewrite.c>

  RewriteEngine on

  RewriteBase /
 
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]

  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  RewriteRule ^index$ http://mydomain.com/ [R=301,L]

  RewriteRule ^page/faqs faqs/ [L]

  RewriteRule ^page/(.*) static_pages/$1 [L]

  RewriteRule    ^$ app/webroot/Index    [L]

  RewriteRule    (.*) app/webroot/$1 [L]


</IfModule>

Thanks :thumbsup:

abduraooft 07-10-2012 11:58 AM

Quote:

RewriteRule (.*) app/webroot/$1 [L]
You may need to add a condition to the above line, like
Code:

RewriteCond %{REQUEST_URI} !^/robots\.txt [NC]
(assuming the robots.txt file is on the root /)

Dannyeo 07-10-2012 03:15 PM

Thanks
 
Thanks for your help. That did the job. Cheers !-) :) :thumbsup:


All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.