17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 3985 Views |
-
SEO Optimisation: 301 redirects, non-trailing slashes and /home

7 April 2008 at 5:30pm Last edited: 9 April 2008 3:11pm
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 -
Re: SEO Optimisation: 301 redirects, non-trailing slashes and /home

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.
-
Re: SEO Optimisation: 301 redirects, non-trailing slashes and /home

9 April 2008 at 4:09pm
If you're using -rc2 it's a known bug and not your modifications fault.
-
Re: SEO Optimisation: 301 redirects, non-trailing slashes and /home

9 May 2008 at 12:17pm Last edited: 9 May 2008 1:20pm
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.
| 3985 Views | ||
|
Page:
1
|
Go to Top |



