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
-
Revamping/Re-optimizing State Pages - What to do with old content?
Hello Moz Fam! I work in the insurance industry and we serve all 50 states. We have a state page for each state where the content is thin(ish). We're slowly revamping each page and hitting every talking point for that specific state. I've used multiple tools to come up with a content template and link building template for each page as well. I spent 5 months last year proof reading all these pages. So the content is good, just not SEO good. I didn't have the team or resources to really optimize them all yet, now I do. My question is... what should I do with the old content? I was thinking of publishing it to other platforms that we have a contributor account on and linking back to each state page with it. Of course, I would wait a few days for the search engines to index the new content so it wouldn't be duplicated on these platforms. Good or bad idea?
Intermediate & Advanced SEO | | LindsayE0 -
Duplicate Content: Is a product feed/page rolled out across subdomains deemed duplicate content?
A company has a TLD (top-level-domain) which every single product: company.com/product/name.html The company also has subdomains (tailored to a range of products) which lists a choosen selection of the products from the TLD - sort of like a feed: subdomain.company.com/product/name.html The content on the TLD & subdomain product page are exactly the same and cannot be changed - CSS and HTML is slightly differant but the content (text and images) is exactly the same! My concern (and rightly so) is that Google will deem this to be duplicate content, therfore I'm going to have to add a rel cannonical tag into the header of all subdomain pages, pointing to the original product page on the TLD. Does this sound like the correct thing to do? Or is there a better solution? Moving on, not only are products fed onto subdomain, there are a handfull of other domains which list the products - again, the content (text and images) is exactly the same: other.com/product/name.html Would I be best placed to add a rel cannonical tag into the header of the product pages on other domains, pointing to the original product page on the actual TLD? Does rel cannonical work across domains? Would the product pages with a rel cannonical tag in the header still rank? Let me know if there is a better solution all-round!
Intermediate & Advanced SEO | | iam-sold0 -
My home page is not found by the "Grade a Page" tool
My home page as well as several important pages are not found by the Grade a Page tool. With our full https address I got this http://screencast.com/t/s1gESMlGwpa With just the www address I got this http://screencast.com/t/BMRHy36Ih https://www.joomlashack.com
Intermediate & Advanced SEO | | etabush
https://www.joomlashack.com/joomla-templates We recently lost a lot of positions for our most important keyword: Joomla Templates Please help us figure this out. Whats screwy with our site?0 -
Ending URLs in .html versus /
Hi there! Currently all the URLs on my website, even the home page, end it .html, such as http://www,consumerbase.com/index.html Is this bad?
Intermediate & Advanced SEO | | Travis-W
Is there any benefit to this? Should I remove it and just have them end with a forward slash?
If I 301 redirect the old .html URLs to the forward slash URLs, will I lose PA? Thanks!0 -
Can Anybody Link to my URL to Hurt SEO? Weird URL pointing at my Domaine!
Our ranking has drop since a few weeks. I did not do any major change in my site. Surfing WebMaster Tool, I found lots of new URL linking at our site: url.org linkarena.com seoprofiler.com folkd.com digitalhome.ca bustingprice.com surepurchase.com lowpricetoday.com oyax.com couponfollow.com aspringcleaning.com pamabuy.com etzone.ca How do I find if those was done intentionelly to hurt SEO? Could it be possible? Thank you, BigBlaze
Intermediate & Advanced SEO | | BigBlaze2050 -
Cleaning up /index.html on home page
All, What is the best way to deal with a home page that has the /index.html at the end of it? 301 redirect to the .com home page? Just want to make sure I'm not missing something. Thanks in advance.
Intermediate & Advanced SEO | | JSOC0 -
Can some brilliant mozzer out there teach a moron/newbie like me how to 301 redirect several URL's I have?
Okay - I am a supermodel. I look pretty. My legs are amazing. My cheekbones are high. But when it comes to 301 redirects I am the ugliest supermodel on the block. Crap, here is the truth: I am not even a supermodel. I am just a middle-aged, goofy looking dude who is a newbie to fixing websites. I have inherited several sites from a friend and I have been helping by creating solid contextual links internally and externally for a while. But, when Roger the wondrous SEOMoz robot talks to me, he says, "oops, it looks like your foolish freak self has a site that has both a www. and a non-www, which can create competition for yourself." What do I do when he says that? I just whisper a "thank-you" but gently press the skip this step button and go on with my life because I do not know how to make my non-www.'s redirect into the www. sites... Now, I have sort of asked this question on the site before, but I was answered by someone who does not understand my level of ignorance. any use of the word canonical or just put this lfwjkshj.htp/php inside the left ear of your mom, does not tell me anything so, is there any willing and kind soul who can walk me through redirecting several of my sites to their proper home - kind of like Carl Chubbs Weathers did for Happy Gilmore in that Academy Award winning classic? Thanks for the help in advance best, dumbhead
Intermediate & Advanced SEO | | creativeguy0 -
Does having a file type on the end of a url affect rankings (example www.fourcolormagnets.com/business-cards.php VS www.fourcolormagnets.com/business-cards)????
Does having a file type on the end of a url affect rankings (example www.fourcolormagnets.com/business-cards.php VS www.fourcolormagnets.com/business-cards)????
Intermediate & Advanced SEO | | JHSpecialty0