Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-10-2012, 09:31 AM   PM User | #1
Dannyeo
New to the CF scene

 
Join Date: Jul 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Dannyeo is an unknown quantity at this point
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
Dannyeo is offline   Reply With Quote
Old 07-10-2012, 11:58 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,689
Thanks: 158
Thanked 2,184 Times in 2,171 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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 /)
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Users who have thanked abduraooft for this post:
Dannyeo (07-10-2012)
Old 07-10-2012, 03:15 PM   PM User | #3
Dannyeo
New to the CF scene

 
Join Date: Jul 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Dannyeo is an unknown quantity at this point
Thanks

Thanks for your help. That did the job. Cheers !-)
Dannyeo is offline   Reply With Quote
Reply

Bookmarks

Tags
exception, htaccess, robots.txt

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:33 AM.


Advertisement
Log in to turn off these ads.