Woocommerce - Removing manually part of the URL cause 404 error - wordpress

As mentioned in the Google's "Search Engine Optimization Starter Guide" (pg 11) a good SEO practice is to give the possibility to users to remove manually part of the URL in the address bar.
In my case:
mysite.com/shop/mycategory/myproduct <-- product page with category ok
removing now manually part of the URL above:
mysite.com/shop/mycategory/ <-- error 404
mysite.com/shop/ <-- works
Breadcrumb in the product page look like this:
home / shop / mycategory / myproduct
clicking on mycategory links to:
mysite.com/product-category/mycategory <-- works
The problem is that the two URL differs:
mysite.com/product-category/mycategory
mysite.com/shop/mycategory/
Any clue on how to resolve this?

From looking at the documentation and other similar posts, some permalinks are not recommended to be adjusted for performance reasons. Your
"mysite.com/shop/mycategory/myproduct"
url is actually looking at:
"mysite.com/shop/product-category/mycategory/myproduct"
So it doesn't look like you will be able to shorten it in the way you describe, although you could restore the "product-category" permalink that i assume you have removed? this way the user will be able to shorten the URL without hitting a 404 error.
http://docs.woothemes.com/document/permalinks/
WooCommerce- How to remove product & product-category from urls?

Related

WooCommerce - a single product url without permalink

I recently discovered that a single product in my WooCommerce shows up in search results without its permalink. I cannot find this product anywhere, and therefore I cannot fix the permalink issue.
The link should read as: /nb/butikk/adheseal-2/
But it reads as: /nb/?product_variation=adheseal-2
Which of course just reroutes to the main page. I cannot find this entry in the system so I have noway of fixing the issue. It's a single post problem because every other item works as expected. Not just this particular link. Seeing as clicking the link doesn't work, I cannot find the post ID either.
I have tried to clean up the DB, resetting permalinks etc. but to no awail.
Any ideas?
It was a cache issue that prevented the permalink update.

How to fix 404 issues after removing category

This is actually an SEO question. I do know quite a bit of SEO but in this case, it's to do with 404's being created across my website. Essentially the WordPress site has left a string of pages not found. The initial installation used the "category" prefix, and now as that has been removed, I have tonnes of 404's popping up. What is the best way to deal with these as there is pagination for each category and there may be hundreds of errors? Making individual 301's does not seem like the best option. And I do not think using regex will work as that redirects to the root address, right? Thanks, everyone for your time.
Just set redirect 301 from your category slug to another page
if your category slug is news, so set a regular expression for all posts that they were in this category and redirect this pattern to another page or post or ....
Just do it in Yoast SEO
from: yoursite/news/[a-zA-z0-9]
to: yoursite/anotherPage

404 Error - With Category Base in URL (WordPress)

I have having really weird problem with Wordpress, I have made some categories like Automotive, CAD etc and I want to keep "topic" as my base url to category URL is something like "www.mywebsite.com/topic/automotive" but When I click on "view" for category, it returns 404 error but If i remove topic from URL to make url look like "www.mywebsite.com/automotive" then category page shows.
I am not able to understand this problem, what could be it and how to resolve it? I tried deactivating all plugins, changed category base from topic to category in permalinks but same issue, url won't show with base it will only show without any base which i don't want.
====== EDIT ======
I JUST NOTICED, IT IS THEME PROBLEM, WHEN I CHANGE THEME, IT WORKS PERFECTLY, SO NOW I HAVE TO FIND OUT THE PART WHERE THE ISSUE IS LYING.
Please help
Regards
Manoj Soni

I don't know why Wordpress worked follow that way

I have a problem with a Wordpress permalink.
These are my steps to show the problem:
1) in admin > pages: I create new page call "GoodMorning" and I have slug "goodmorning", on frontend, I run ://my_domain/goodmorning will show the content of this page
2) Now, I run ://my_domain/find-me/goodmorning it will auto redirect to ://my_domain/goodmorning
/find-me/ : this is any name and this text does not exist on wordpress slug, category, page, post, ....
Please let me know why. I want it to show a 404 page when I run ://my_domain/find-me/goodmorning.
Thanks All.
Adding this (to functions.php) should stop that redirect.
remove_action('template_redirect', 'redirect_canonical');
If you look at the documentation for redirect_canonical here:
Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query. Will instead try to parse the URL or query in an attempt to figure the correct page to go to.
I assume that's what you're trying to prevent based on your question.
If you need the other functionality of redirect_canonical you can just cancel the redirect by returning false to this filter, like so:
add_filter('redirect_canonical', '__return_false');
You need to flush your permalinks configuration afterwards:
In the main menu find "Settings > Permalinks".
Scroll down if needed and click "Save Changes".
Rewrite rules and permalinks are flushed.

Wordpress and Woocommerce: remove /product and /product-category from URL structure

Dear StackOverflow friends,
in a site with Wordpress and Woocommerce plugin,
I would like to change the URL of the pages of e-commerce in an SEO friendly structure and in particular I would like:
1) the individual product pages
www.mysite.com/product/productname
to become
www.mysite.com/productname
2) and the product category pages
www.mysite.com/product-category/categoryname
to become
www.mysite.com/categoryname
As regards the case 1 /product,
I have not found a plugin that could help me and I tried
A- to modify WordPress permalinks: inserting a slash followed by a dot /. products , URL takes on the structure that I want but the pages are no longer accessible and bring me an error of 'redirection loop'
B- to modify the .htaccess file, adding the following lines of code
// 301 Redirect Entire Directory
RedirectMatch http://testmywpshop.info/prodotto(.* 301) http://testmywpshop.info/$1
but probably I have not written/inserted that code correctly, because the site becomes inaccessible!
As regards the case 2 about /product-category,
I tried the plugin SEO Ultimate which has the function that suites my needs and I successfully converts the URL structure of product categories, but I'd prefer to get the same result without using it, because my friend wants to use SEO Yoast and there may be conflicts between these two plugins.
In conclusion, I wish URL wouldn't suffer broken links and redirections to be more acceptable to Google (maybe using the 301 redirection because it seems to be the only liked by robots) or even change the WordPress core code that determines the structure of the URL, but I have not been able to find it!
I read this Stack post and this Woocommerce documentation but I'd like to find an alternate way, if possible in your opinion.
I would also be happy to know your opinion about the usefulness of a modified URL structure, removing irrelevant words to the products sold in a e-commerce, to meet Google requirements (I found conflicting information about this subject).
Thanks for your advice and your help!
I would also be happy to know your opinion about the usefulness of a modified URL structure, removing irrelevant words to the products sold in a e-commerce, to meet Google requirements (I found conflicting information about this subject).
If you are looking to do this change to meet SEO Best Practices requirements, please note that this particular URL suggestion happened due to products that belong to multiple categories.
As such, urls that include categories can be detrimental.
www.example.com/product/drinks/milkshake and www.example.com/product/desserts/milkshake point to the same product. However, the problem here is not /product/ but /drinks/ and /milkshake/.
a WooCommerce site with a default product url like www.example.com/product/product-name is technically ok. I prefer to set my urls to www.example.com/shop/product-name as well as www.example.com/shop/category-main/category-sub/ as it is more descriptive. You can do this on WordPress Admin>Settings>Permalinks.
That said, if WooCommerce documentation says it's not a good idea, I usually don't pursue it. :)
Its possible to change the url structure, use a plugin for this.
old situation: domain.com/product/blue-trouser
new situation: domain.com/blue-trouser
or with categories
old: domain.com/product-category/pants/blue-trouser
new: domain.com/pants/blue-trouser
You will have to buy a plugin to get it this way.

Resources