3510 Posts in 770 Topics by 480 members
Jump to:If this is your first visit, you will need to register before you can post. However, you can browse all messages below.
| Page: 1 | go to end | Reply | |
| Author | Topic: SEO Optimisation: 301 redirects, non-trailing slashes and /home | 520 views |

7 April 2008 at 5:30pm
In the recent months, Fabie and I have been seeking for an unobtrusive mechanism to further optimise SilverStripe based installations for search engines.
That is, pages with a trailing slash and pages without a trailing slash are accessible to search engine crawlers. While this isn't necessarily an issue for humans, it essentially creates two independent pages with identical content; resulting in various negative implications for search engines.
The phenomena is known as Canonical URLs.
Fortunately, a developer from Fontis IT consulting and T3hDuk have been able to formulate a suitable work-around that takes advantage of Apache's mod_rewrite functionality. That is, it doesn't touch the Sapphire core at all!
I thought it would be appropriate to share with everyone, in case other developers feel that they are in a similar position to me.
* Adds a trailing slash to URLs without a trailing slash
* Capability to redirect requests without the WWW to include the WWW
* Correct the /home 302 redirect
* All redirects are 301
Last edited: 9 April 2008 at 3:11pm

9 April 2008 at 3:16pm
Discovered a problem where files could not be uploaded using the "Files & Images" section of the CMS. I've modified the rewrite rules to exclude /admin. The "pastie" in my previous post has already been updated.

9 April 2008 at 4:09pm
If you're using -rc2 it's a known bug and not your modifications fault.

9 May 2008 at 12:17pm
That's great Tatey, was exactly what I needed.
I have a suggestion:
Change:
RewriteCond %{HTTP_HOST} ^domain\.com.\au [NC]
to:
RewriteCond %{HTTP_HOST} ^domain\.com.\au$ [NC]
This way you will then capture domain.com.au/somepage/ which will rewrite with the www.
.. and you may wish to change this line also to include other common file types otherwise these files won't be found due to the rewrite adding a / at the end.
Change:
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
to:
RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)|(\.flv)|(\.swf)|(\.html)|(\.htm)$
Or simply make is include any other file types you need to be detected.
Last edited: 9 May 2008 at 1:20pm
| 520 views | |||
| go to top | Reply |