Reputation: 1015
I want to edit my robots.txt file in OpenCart 2.* from admin panel. Does anybody know how to do it?
Is it a standard feature or I need to install any extensions?
List of modules or code examples will be perfectly.
Upvotes: 0
Views: 1849
Reputation: 1317
Hi OpenCart does not have robots.txt file by default. There is no setting in admin panel too.
However this is very simple, you can simply create robots.txt file in your website root directory. A brief example of syntax is given below.
Robots.txt is a text (not html) file you put on your site to tell search robots which pages you would like them not to visit.
It is important to clarify that robots.txt is not a way from preventing search engines from crawling your site (i.e. it is not a firewall, or a kind of password protection) and the fact that you put a robots.txt file is something like putting a note “Please, do not enter” on an unlocked door – e.g. you cannot prevent thieves from coming in but the good guys will not open to door and enter.
Block all web crawlers from all content
User-agent: *
Disallow: /
Block a specific web crawler from a specific folder
User-agent: Googlebot
Disallow: /no-google/
Block a specific web crawler from a specific web page
User-agent: Googlebot
Disallow: /no-google/blocked-page.html
Sitemap Parameter
User-agent: *
Disallow:
Sitemap: http://www.example.com/none-standard-location/sitemap.xml
Hope it helps.
Upvotes: 1
Reputation: 2533
You have to write module that can edit file. So look on file_get_contents and file_put_contents
Upvotes: 0