Login | Forgot password | Register
What is OpenID?
OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
General Questions
SilverStripe Forums » General Questions » Preventing duplicate pages - /mypage and /mypage/
General questions about getting started with SilverStripe that don't fit in any of the categories above.
|
Page:
1
|
Go to End | |
| Author | Topic: Preventing duplicate pages - /mypage and /mypage/ | 340 Views |
-
Preventing duplicate pages - /mypage and /mypage/

5 June 2009 at 3:28pm Last edited: 8 June 2009 8:36am
www.mysite.com/mypage and www.mysite.com/mypage/
If you check your silverstripe site, you will find that most likely you can browse to either and they both will be seen
How can that be prevented - so just the /mypage/ works - it is becoming an a duplicated content with google. Webmaster tools tell us that each page has the same title - description etc, which is frowned upon and not good seo
Is there a solution to prevent possibility of www.mysite.com/mypage being viewed and producing a 404 error
cheers
Peter -
Re: Preventing duplicate pages - /mypage and /mypage/

9 June 2009 at 3:16pm
Ok - no response
New question then
What sitemap.xml generator are people using? I may be able to resolve the issue by using a different generator
If someone from silverstripe could reply that would be good - each of the file names end with / in http://silverstripe.org/sitemap.xmlcheers
Peter -
Re: Preventing duplicate pages - /mypage and /mypage/

10 June 2009 at 3:05am
A properly generated sitemap should get rid of your issue.
What version of SIlverstripe are you using? There is a googlesitemap module available in the Silverstripe svn, and it is also bundled with 2.3.1.
Hope that helps,
Mo
-
Re: Preventing duplicate pages - /mypage and /mypage/

10 June 2009 at 7:02pm
Regarding your original question.
You could either redirect URLs without trailing slash to the one with slash (put this in your .htaccess):
RewriteCond %{REQUEST_URI} !/$
RewriteRule .* %{REQUEST_URI}/ [R=301,NC,L]
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L].. or you could only accept URLs with a trailing slash (the following code only redirects URLs with a trailing slash to SilverStripe. All others are up to the webserver to handle and will usually result in a 404 error):
RewriteRule ^(.*/)?$ sapphire/main.php?url=%1&%{QUERY_STRING} [L]
-
Re: Preventing duplicate pages - /mypage and /mypage/

10 June 2009 at 8:43pm
I don't know if redirecting to a 404 would be wise, someone may type your URL from memory, but forget the last slash. In that situation the user would get a page not found and not understand why.
-
Re: Preventing duplicate pages - /mypage and /mypage/

29 June 2009 at 3:20pm
Sitemap generator: http://www.xml-sitemaps.com/
-
Re: Preventing duplicate pages - /mypage and /mypage/

29 June 2009 at 4:02pm
Thanks - that is what I was using. I have a solution from them - I will share as follows:
this worked:
In Do not parse URLs: I added
.*mypage$so only indexes /mypage/ rather than both /mypage/ and /mypage
cheers
Peter -
Re: Preventing duplicate pages - /mypage and /mypage/

29 June 2009 at 4:44pm
and we found out what the cause of the xml sitemap generating those duplicated pages.
The sitemap page (mysite/code/SiteMap.php) had been customised to produce some xml metadata for DigitalNZ to trawl content pages and was missing a trailing slash
Another SS lesson learned
cheers
Peter
| 340 Views | ||
|
Page:
1
|
Go to Top |
Currently Online: There is nobody online.
Welcome to our latest member: U




