Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile 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

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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 /)
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Dannyeo (07-10-2012)

  • #3
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thanks

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


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •