Recent Topics

twitter cards do not work as expected - probably a .htaccess problem?

Started by on Feb 08, 2019 – Contents updated: Feb 12, 2019

Feb 08, 2019 13:51    


I have realized, that tweets posting links to my collections behave different since I upgraded to 6.10.6. Twitter cards do not show the teaser image and the card switched from a big image to a small. Does the upgrade cause a bug in the plugin?
See the screenshots:

Regards, Will

Exact b2evolution version number :6.10.6

Feb 08, 2019 17:22

I tried to check and solve the problem.

First, I checked robots.txt - the access to media folder is allowed

Then I checked .htaccess . Therfore I compared two physically separated installations (both Version 6.10.6) for .htaccess and found out, that the installations differ.

Installation A
+ /blogs/media/.htaccess

- /html/blogs/rsc/.htaccess
- /html/blogs/locales/.htaccess
- /html/blogs/skins/.htaccess
- /html/blogs/conf/.htaccess
- /html/blogs/inc/.htaccess
- /html/blogs/skins_email/.htaccess

Installation B
- /blogs/media/.htaccess

I assume, that htaccess in media is not correct.
But i don't know how it behaves with the other files missing in installation A

Could you deliver a list of folders that should have a .htaccess?

Thanks and regards, Will

Feb 10, 2019 19:58

@fplanque I deleted the .htaccess file in /media folder and now twitter cards work fine.

But please tell me, what I should do towards the different use of .htaccess file in two installations, each with version 6.10.6

Thanks and Regards, Will

Feb 11, 2019 10:07

@fplanque the information provided at that page your link referrs to, mentions to set .htaccess e.g. to /media. But that would - as I now experieced - cause, that twitter cards don't really work, because Twitter could not show images from the page, to which a tweet links.
To ensure that not every service etc. have access to /media folder, after I deleted the .htaccess file in this folder, I edited robot.txt:and adapted it this way:

User-agent: *
Disallow: /blogs/media/

Allow: /blogs/media/blogs/

Feb 11, 2019 14:09

That is not correct. You have to use the correct media/sample.htaccess from the b2evolution distribution.

See Warning here:

For the media folder, the correct file contents are:

# We don't want any PHP execution in this folder! (Prevent direct invocation of PHP files)
<IfModule mod_php5.c>
    php_flag engine off

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Redirect any _evocache file that does not exist to generate new by htsrv/getfile.php:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{QUERY_STRING} mtime=(\d+)
    RewriteRule ^(.+/[_\.]evocache/.+/([a-z0-9\-]+)\.[a-z]{3,4})$ /htsrv/getfile.php?abspath=$1&size=$2&mtime=%1 [L]

Feb 11, 2019 15:26

@fplanque I did not add any PHP execution in a file or folder on b2evolution. I just added lines to robot.txt in the root directory
But I loaded the .htaccess file as recommende to /media

I have other lines in robot.txt:

User-agent: *
Disallow: /blogs/media/
Disallow: /blogs/htsrv/
Disallow: /blogs/xmlsrv/
Disallow: /blogs/?disp=msgform

should I delete these?

Feb 12, 2019 00:35

OK, sorry I did make a confusion by reading quickly but make sure you understand this:

  • robot.txt is for kindly asking third parties to not index files you don't want them to index. This is a "nice to have" setting.
  • .htaccess is for protecting your folders against potential hacks. This is a "Highly recommended for best security" setting.

Feb 12, 2019 09:00

@fplanque yes, I know; to disallow /media by robot.txt should prevent my images to be crawled by google. google - up to now - respects robot.txt, also bing and e.g. twitter does - other search engines and most of the social services don't bother me.
Thanks for your support.

Form is loading...

Secure CMS – This forum is powered by b2evolution CMS, a complete engine for your website.