Complete Guide on SEO for Drupal



1. Enable Search Friendly Urls - The very first thing you want to is to enable search engine friendly urls. You should see this option at the time of installing Drupal but in case you missed it, you can go to Modules (/admin/build/modules) and enable Path module which comes with core installation but is disabled by default. Path module will convert /node?q=1 urls to /node/1.

2. Install Pathauto Module - Install pathauto module too which allows you to create search engine friendly urls. PathAuto module offers various settings like removing characters like a,an,the as well as to write your own custom paths using tokens.

3. Install Global Redirect Module - There is a Global Redirect module which is a must as it will take care of the canonical url problems as well as it do 301 redirect from urls like /node/1 to /node/my-name so if you access /node/1 or /node/1/ it will redirect to /node/my-name

4. fix Robots.txt - Drupal comes with default robots.txt which hides most of the system files and directories but still if you are looking to block some pages from search engines, you want to edit the file and add the paths. There is a module robots.txt but I feels you are better of editing it manually. Do note that you need to remove/rename the default robots.txt file if you are using the module.

5. Redirect www to non www or non www to www in Drupal - If you are not redirecting one to other, search engines will treat www and non www as two sites which can cause lot of unnecessary duplication and the server will get hit twice by bots. Also on social media, some of your links will be www and some will be non www, again something which you can avoid. At inBoundio, I redirect non www to www so you can do something similar. If you look drupal code hosted at github, https://github.com/drupal/drupal/blob/7.x/.htaccess is the .htaccess file which is well commented for you to make changes. You can also do it at php lever adding some 301 redirects but since .htaccess is read by web server first, the client http request never hits your drupal installation reducing the memory usage.

# To redirect all users to access the site WITH the ‘www.’ prefix, # (http://example.com/… will be redirected to http://www.example.com/…) # uncomment the following: # RewriteCond %{HTTP_HOST} . # RewriteCond %{HTTP_HOST} !^www\. [NC] # RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # To redirect all users to access the site WITHOUT the ‘www.’ prefix, # (http://www.example.com/… will be redirected to http://example.com/…) # uncomment the following: # RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] # RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]



6. Canonical urls problem - Canonical urls are example.com/my-name and example.com/my-name/ which are two different urls pointing to same content which can often be considered as duplicate content. Though search engines have got much smarter and it looks like they are able to understand this, it is good if you take care of this at drupal level itself. - Canonical urls are example.com/my-name and example.com/my-name/ which are two different urls pointing to same content which can often be considered as duplicate content. Though search engines have got much smarter and it looks like they are able to understand this, it is good if you take care of this at drupal level itself.





7. Path Redirect Module - If you are changing url of an older page say /older-page to /newer-page, you don't want older page to give 404 page not found error but still want it to 301 redirect to the new page. This can be done with Path_Redirect module. There is also path access module too which can be used to block some urls from search engines (in drupal that will anonymous role type)

8. Fixing and adding title and description of pages - by default, every content type in drupal has "$title" variable which eventually becomes Title but if you want different text in meta tag title, you can install Metatag plugin (for Drupal 7) or nodewords plugin (for drupal 6) which will also take care of description tag too. There is a dublin module in drupal, avoid using that as it adds some tags. - by default, every content type in drupal has "$title"unnecessary dublin title





9. No index for categories, tags and taxonomy - If you are using tags, category or taxonomy, you probably want to avoid them getting indexed in google specially if the content is not very useful. By default, robots.txt do block /taxonomy/ urls but most often people uses custom urls so you can add /categoryname/* in robots.txt file.





10. SEOTools module and SEO Checklist - Do install - Do install SEOTools module as well as SEO checklist module too. Both helps you to keep things organized and can take care of majority of the seo headache.





11. XMLSIteMap and Sitemap module - if you are running a big site with many internal urls including those which are not linked from other pages, you can use - if you are running a big site with many internal urls including those which are not linked from other pages, you can use xmlsitemap module which creates a sitemap of all the urls (depending on the settings) and also submit it to the search engines. There is also one more sitemap module which creates link sitemap unlike xmlsitemap, which can be handy as an index page for the site.





12. Google webmaster and Bing webmaster Modules - Do not forget to add your site to google webmaster tool and Bing Webmaster too. You just need to submit your site and verify it. There is a - Do not forget to add your site to google webmaster tool and Bing Webmaster too. You just need to submit your site and verify it. There is a quick_verify drupal module for quick verification so you don't have to manually upload the files or edit cname record.







If you know more such ways to make drupal more optimized for search engines, please tell it in comments.