Skip to main content

Articles tagged with "seo"

Customise scaffold files the right way

16th Jun 2020

There are some key files like robots.txt and .htaccess which are often tweaked for Drupal websites. These can be considered part of the 'scaffolding' of a site - they control the way the site works, rather than its content or design. Any new release of Drupal core that includes changes to them specifically mentions that they need updating, as those changes may have to be merged with any customisations made on your site. For example, there was a security release that added rules to .htaccess, which were essential for any site to incorporate and the template settings file, default.settings.php...

Read more

12 month contrib challenge: XML sitemap

5th May 2020

We've been busy recently, but that doesn't stop us at ComputerMinds contributing back to the Drupal community! For our latest multilingual website, we needed an XML sitemap with alternate links and hreflang attributes. This site uses separate domains for each language - for example, www.example.se (??) and www.example.no (??). Search engines need these alternate links to help them understand how to match up each translation of a page, which are distributed across these different domains. But this site is built on our existing Drupal 7 e-commerce platform that uses the XML sitemap project, which has no support for alternate links (nor entity translation...

Read more

Boost your speed with lazy images

11th Jun 2019

Websites need to look pretty and be blazing fast. That often means lots of beautiful high-quality images, but they can be pretty enormous to download, making the page slow to load. Images are often one of the 'heaviest' parts of a website, dragging a visitor's experience down instead of brightening it up as intended. If a website feels even a tiny bit unresponsive, that tarnishes your message or brand. Most of us have sat waiting frustratedly for a website to work (especially on mobile), and given up to go elsewhere. Drupal can be configured to deliver appropriately-resized versions, but what's...

Read more

Removing that pesky trailing slash

11th Nov 2010

So, it's perfectly valid to visit a site using a URL like:

http://www.google.co.uk///////////

But some pesky SEO types will complain that the site is accessible at two URLs and that you need do a 301 redirect to the canonical URL (http://www.google.co.uk/). What you want to do is remove the trailing slashes using mod rewrite.

If you really need to do this, then you can just pop the following in the .htaccess file that Drupal provides:



  # Remove multiple slashes after domain
  RewriteCond %{HTTP_HOST} !=""
  RewriteCond %{THE_REQUEST} ^[A-Z]+\s//+(.*)\sHTTP/[0-9.]+$
  RewriteRule .* http://%{HTTP_HOST}/%1 [R=301,L]

just before the # Rewrite URLs of the form...

Read more