Redirect both / and non-/ URLs?
-
I am doing SEO on WP site. Due to some duplicate pages (rel canonical was done before) I am doing 301 redirects at the moment. And I wonder if I need to redirect both links w/ and w/o trailing slash. Default is non www, w/o trailing slash.
Like there is .com/category/news but there is same page linked in .com/news (well it works when permalink structure is set to /%category%/%postname% and returns 404 error when structure is set to /%postname%).
I redirected .lt/naujienos to .lt/category/naujienos. Should I also redirect .lt/naujienos/ (with trailing slash)?There's absolutely no problem redirecting this, but there are some more pages which I want to edit their URLs and I wonder If I should do both redirects from links /w and w/o slash?
-
There is my .htaccess at the moment:
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule>I don't want to mess with it because I don't have an access to cpanel.
-
Well, I want non-trailing URLs as they are at the moment. They should be (the ones without trailing slash) rel canonical as they were before I changed permalink structure ( it was set to default: /?p=123) to /%postname%
I guess I will wait a crawl to see how it is at the moment and fix all those pages with 404.
BTW, google shows my site and pages with /. Maybe it hasn't recrawled yet.
-
Another option would be to add another re-direct rule that would add a trailing slash to all of the URLS.
So effectively, if you re-direct the non-trailing URLS all URLS would then have a trailing slash.RewriteCond %{REQUEST_URI} !.[^./]+$
RewriteCond %{REQUEST_URI} !(.)/$
RewriteRule ^(.)$ /$1/ [R=301,L]Give this a try maybe? Just ensure that the REL Canonical reflects the URLS WITH the trailing slash otherwise you will get stuck in a canonical loop.
Craig Curchin
Twitter: @craigcurchin -
Fisher,
Google deals with both with / and without / as though they are the same thing so I wouldn't worry about redirecting those. If visitors normally get a trailing slash, canonicalize that, if they don't canonicalize on the URL without the slash.
http://www.mattcutts.com/blog/seo-advice-url-canonicalization/
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
-
301 redirects
I am in the process of truncating many of the URLs using a plugin installed on Wordpress. The question is does google penalize or have issues with too many 301 redirects on your site. I have many many products I want to do this with. I thought I read somewhere that 301 redirects should be held to a minimum. Would appreciate any assistance
On-Page Optimization | | xinar0 -
Redirect chains and rankings
Hi All, I've got interesting question for Moz community today. Has redirect chain got any impact on rankings or not? Thank you in advance.
On-Page Optimization | | Optimal_Strategies0 -
SEO Onpage (where I need to put the H1/2/3)?
Hi everybody, I'm working on my new website, and I have a few questions about the Headers (<h 1="" 2="" 3="">)
On-Page Optimization | | JohnPalmer
please see the attached image, I create a mock-up for you, please tell me which H I have to put on the title.
(** most of the articles will be without sub-titles so...it will be dynamic, but try to take a look on the "sidebar" and "menu link".</h> 6ER0EpK0 -
How to fix this URL?
Moz crawl test only show one URL indexed for the website - http://ravisharrma.com/ Site:http://ravisharrma.com/ shows 3 URLs and how to fix URLs for the website?
On-Page Optimization | | Dan_Brown10 -
URL Question
This url looks bad: http://www.patrickmunoz.com/#!classes/c1vw1 And when you click around the page change doesn't actually occur, it's a fade into the next page. I think this is a major problem for rankings. Although pages are crawled: https://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.patrickmunoz.com%2F&oq=site%3A&aqs=chrome.2.69i57j69i58j69i59l3j69i61.3548j0j7&sourceid=chrome&espv=210&es_sm=122&ie=UTF-8 When I search for a simple page - "patrick munoz FAQs" nothing comes up:
On-Page Optimization | | tylerfraser
https://www.google.com/search?q=site%3Ahttp%3A%2F%2Fwww.patrickmunoz.com%2F&oq=site%3A&aqs=chrome.2.69i57j69i58j69i59l3j69i61.3548j0j7&sourceid=chrome&espv=210&es_sm=122&ie=UTF-8#q=patrick+munoz+|+FAQs Do you think this is a bad url configuration? Thanks! Tyler0 -
Articles URL
Hello, Currently, I am parsing article base on article ID on URL request. For example:
On-Page Optimization | | JohnHuynh
To go to the content of article **What is the visa on arrival? How to get it? **I am using URL like that http://www.vietnamvisacorp.com/news/what-is-the-visa-on-arrival--how-to-get-it--245.html and base on ID 245 to get this page content.
But, now I want to optimize this URL to http://www.vietnamvisacorp.com/news/what-is-the-visa-on-arrival--how-to-get-it.html. Then I got a problem: How to get an article without ID? Thanks,0 -
Canonical URL problem
On page analysis wanted me to add a canonical url tag. However I added then re ran the on page analysis and it came up with an error. What is the proper way to add a canonical url tag in the head of an index page? ie. add a canonical tag to www.hompeage.com/index.html would it be ? Or should I ignore this for a home page? Because I add it then run the analysis again and get this? Appropriate Use of Rel Canonical Moderate fix <dl> <dt>Canonical URL</dt> <dd>"http://www.ensoplastics.com/index.html"</dd> <dt>Explanation</dt> <dd>If the canonical tag is pointing to a different URL, engines will not count this page as the reference resource and thus, it won't have an opportunity to rank. Make sure you're targeting the right page (if this isn't it, you can reset the target above) and then change the canonical tag to reference that URL.</dd> <dt>Recommendation</dt> <dd>We check to make sure that IF you use canonical URL tags, it points to the right page. If the canonical tag points to a different URL, engines will not count this page as the reference resource and thus, it won't have an opportunity to rank. If you've not made this page the rel=canonical target, change the reference to this URL. NOTE: For pages not employing canonical URL tags, this factor does not apply.</dd> <dd>So do I add it or not? If I don't I get a lower page rating if I take it off I get a higher page rating with room for improvement. </dd> </dl>
On-Page Optimization | | ENSO0 -
Is it worth changing urls with underscores?
A few pages on one of my sites have underscores linking keywords rather than hyphens (keywords_and_keyword rather than keyword-and-keyword). Possibly from a time before I knew hyphens were preferred... One of the pages ranks well, and drives a good amount of traffic. The others do not do so well, but are still within the top 10 landing pages for the site. Is it worth me changing the underscores to hyphens (setting up 301 redirects first of course) or doesn't it make that much difference?
On-Page Optimization | | Jingo010