CMS Pages - Multiple URLS (/)
-
Hi guys, this type of question has been asked a few times before but I couldn't find something that told me what i need so apologies if its a tad repetitive.
I use Magento, and have several pages using its CMS. However, it produces 2 URLS for each page with a simple /.
For example,
website.com/hire
website.com/hire/I know google treats this as 2 separate pages, which would be the better solution.
1. Write a URL re-write for every CMS page
RewriteRule ^hire$ http://www.website.com/hire/ [R=301,L] (Is this right?)2. Write a general rewrite rule to always add the /
No idea where to begin with this3. Add a Canonical tag to the page which i think is possible in magento by adding this to the Custom Design Layout XML option in the page CMS.
<action method="addLinkRel"></action> <rel>canonical</rel> <href>http://www.website.com/hire/</href>
This would make the /hire/ page self-reference and the /hire page reference the /hire/ page I think. Which one of these solutions is the best and any pointers with the coding would be grand.
-
Hi,
Far from being an htacess expert, but you could also try this rule:
RewriteCond %{REQUEST_URI} /+[^.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L](off course I didn't invent it myself - it's coming from here: https://github.com/phanan/htaccess#force-trailing-slash )
I tried it here http://htaccess.madewithlove.be/ - and it seems to work if url is in the form
mydomain.com/article => mydomain.com/article/If you check with mydomain.com/article.htm - it's not redirected
Could be an alternative if the rule proposed by Andy wouldn't work.
Rgds,
Dirk
-
Very welcome and glad it has been of help
-Andy
-
Thanks Andy, i will try this on Tuesday after the bank holiday and see if i can get it working. Either way you have provided a workable solution for me so thanks very much!
-
Have a try of this:
<code>RewriteCond %{REQUEST_URI} !\.(html)$</code>
I think this should work by ignoring anything with .html
Give it a go but if not, you may need to wait for someone else to come and confirm it
-Andy
-
Hmmm slight hic-cup
I just noticed the pages ending
.html
such as category and product pages are now also being given a /
Would you advise just swapping and using the remove / rule or is there an edit to this code so it only happens to page that dont end in .html
-
Perfect. Glad to hear it has helped
-Andy
-
Thanks Andy, it worked a charm and testing doesn't seem to show any errors elseware.
I used the 'enfore a trailing slash' version included in the same article you provided which was
RewriteCond%{REQUEST_FILENAME}!-f
RewriteRule^(.*[^/])$ /$1/[L,R=301]For anybody else thats interested.
-
No need to go with canonicals. A bit of .htaccess code should do it. Pretty sure I got this from Stack Overflow in the past for a client with the same issue:
<code>RewriteCond%{REQUEST_FILENAME}!-d RewriteRule^(.*)/$ /$1 [L,R=301]</code>
Give that a go and let me know how you get on.
Edit - Found the page I was looking for here http://stackoverflow.com/questions/21417263/htaccess-add-remove-trailing-slash-from-url
Cheers,
Andy
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
How does Googlebot evaluate performance/page speed on Isomorphic/Single Page Applications?
I'm curious how Google evaluates pagespeed for SPAs. Initial payloads are inherently large (resulting in 5+ second load times), but subsequent requests are lightning fast, as these requests are handled by JS fetching data from the backend. Does Google evaluate pages on a URL-by-URL basis, looking at the initial payload (and "slow"-ish load time) for each? Or do they load the initial JS+HTML and then continue to crawl from there? Another way of putting it: is Googlebot essentially "refreshing" for each page and therefore associating each URL with a higher load time? Or will pages that are crawled after the initial payload benefit from the speedier load time? Any insight (or speculation) would be much appreciated.
Intermediate & Advanced SEO | | mothner1 -
Bingpreview/1.0b Useragent Using Adding Trailing Slash to all URLs
The Bingpreview crawler, which I think exists in order to take snapshots of mobile friendly pages, crawled my pages last night for the first time. However, it is adding a trailing slash to the end of each of my dynamic pages. The result is my program is giving the wrong page--my program is not expecting a trailing slash at the end of the urls. It was 160 pages, but I have thousands of pages it could do this to. I could try doing a mod rewrite but that seems like it should be unnecessary. ALL the other crawlers are crawling the proper urls. None of my hyperlinks have the slash on the end. I have written to Bing to tell them of the problem. Is anyone else having this issue? Any other suggestions for what to do? The user agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 BingPreview/1.0b
Intermediate & Advanced SEO | | friendoffood0 -
Pages with rel "next"/"prev" still crawling as duplicate?
Howdy! I have a site that is crawling as "duplicate content pages" that is really just pagination. The rel next/prev is in place and done correctly but Roger Bot and Google are both showing duplicated content + duplicate page titles & meta's respectively. The only thing I can think of is we have a canonical pointing back at the URL you are on - we do not have a view all option right now and would not feel comfortable recommending it given the speed implications and size of their catalog. Any experience, recommendations here? Something to be worried about? /collections/all?page=15"/>
Intermediate & Advanced SEO | | paul-bold0 -
Keywords going to Subdomain instead of targeted page(general landing page)
Why are some of my keywords going to subdomains instead of the more general/targeted landing page. For example, on my ecommerce website, the keyword 'tempurpedic' is directing to the subdomain URL of a specific tempurpedic product page instead of the general landing page. The product has a page authority of 15 and the Tempurpedic landing pages with all the products has an authority of 31. I have also noticed that my 'furniture stores in houston' keyword directs to my "occasional tables" URL! instead of a the much more targeted homepage. Is there something I am missing here?
Intermediate & Advanced SEO | | nat88han0 -
Page 1 Reached, Further Page Improvements and What Next ?
Moz, I have a particularly tricky competitive keyword that i have finally climbed our website to the 10th position of page 1, i am particularly pleased about this as all of the website and content is German which i have little understanding of and i have little support on this, I am pleased with the content and layout of the page and i am monitoring all Google Analytics values very closely, as well as the SERP positions, So as far as further progression with this page and hopefully climbing further up page 1, where do you think i should focus my efforts ? Page Speed optimization?, Building links to this page ?, blogging on this topic (with links) , Mobile responsive design (More difficult), further improvements to pages and content linked from this page ? Further improvements to the website in general?,further effort on tracking visitors and user experience monitoring (Like setting up Crazyegg or something?) Any other ideas would be greatly appreciated, Thanks all, James
Intermediate & Advanced SEO | | Antony_Towle0 -
301 redirect for page 2, page 3 etc of an article or feed
Hey guys, We're looking to move a blog feed we have to a new static URL page. We are using 301 redirects but I'm unsure of what to regarding page 2, page 3 etc. of the feed. How do I make sure those urls are being redirected as well? For example: Moving FloridaDentist.com/blog/dental-tips/ to a new page url FloridaDentist.com/dental-tips. So, we are using a 301 on that old url to the new one. My questions is what to do with the other pages like FloridaDentist.com/blog/dental-tips/page/3. How do we make sure that page is also 301'd to the new main url?
Intermediate & Advanced SEO | | RickyShockley0 -
I do a lot of on page SEO... I was wondering some basic tactics / strategies for link building? Please provide only WHITE HAT suggestions! Thank You ;)
Please keep in mind google's announcement on links recently.
Intermediate & Advanced SEO | | entourage2120 -
Sitelinks in 7-pack / blended / local results
I have a client who has been ranking well in the 7-pack for local searches, for 1.5+ years. I recently noticed a competitor's Google Places link has little sitelinks attached, but my client's link doesn't have them. This makes me sad. To provide a concise question: what can I do to help my client get sitelinks along with his Google Places listing in the 7-pack / blended / local results? Some example data: My client's business is called Ambiance Dental and his website is www.mycalgarydentist.com. An example search to see what I'm talking about is "calgary family dentist". The competitor that's showing sitelinks is www.aestheticdentalstudio.ca which has a title of "Dentist in Calgary | Cosmetic Treatment in Calgary". The sitelinks you'll see are "Dr. Gordon Chee", "Links", "Dr. Alexa Geminiano". Notice that my client doesn't have the same sitelinks. Some further data: If you do a a search for "calgary aesthetic dentist" you'll see the competitor's 1-box local result (is that what it's called?) with his Google Places data and sitelinks. If you search for "calgary ambiance dentist" you'll get a similar layout SERP for my client, again with no sitelinks. My client's sitelinks: If you search for "ambiance dental calgary" you'll see that Google does offer sitelinks for his site, just not in Google Places it seems. My client's website: My client's website has the navigation coded as a list (UL) without any javascript or complicated code messing things up. The competitor's navigation is built similarly, though he has about 40 more pages in his main navigation. My client's page names are concise, which I've read helps with sitelinks, the website is coded very cleanly, the URLs of his site are clear and concise without a complicated folder structure, so it seems like we're doing everything right. I appreciate any input other mozzers can provide, and discussion on the topic. I'm sure there are others who would benefit from local sitelinks as well!
Intermediate & Advanced SEO | | Kenoshi0