How to open robots.txt instead of download for AEM site | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anish-Sinha

hi @user00181 ,

The above solution will work, but if you don't want to make changes to the configuration file, you can add a rule at your dispatcher for a specific file so that it will open in the browser instead of downloading. 

<FilesMatch "\.robots.txt$">
    Header set Content-Disposition "inline"
    Require all granted
</FilesMatch>

2 replies

SantoshSai
Community Advisor
Community Advisor
June 30, 2022

Hi @user00181 ,

Your robot.txt resource file by default have jcr:data property or jcr:content/jcr:data which has an header with value as "attachment".

You need to make an entry (exclude entry to not have the Content-Disposition as attachment)

  • Apache Sling Content Disposition filter (in your publish instance) -> Clear cache, if desired and then try accessing the file. 

Regards,

Santosh 

Santosh Sai
Anish-Sinha
Adobe Employee
Anish-SinhaAdobe EmployeeAccepted solution
Adobe Employee
June 30, 2022

hi @user00181 ,

The above solution will work, but if you don't want to make changes to the configuration file, you can add a rule at your dispatcher for a specific file so that it will open in the browser instead of downloading. 

<FilesMatch "\.robots.txt$">
    Header set Content-Disposition "inline"
    Require all granted
</FilesMatch>
user00181Author
Level 2
July 6, 2022

Hi @anish-sinha 

Thank you for solution,

I am new in AEM where i need to add this rule . Actually I am using AEM 6.5 version. 

There are already some rule are available for robots.txt file.

Please check this Screenshot, in this code what i need to change or add so the robots.txt fill will open.

 

 

Thanks,

Niraj Singh