I have a Vue site, and I meet some seo problem recently.
Just like the picture below, I don’t know how to use netlify.toml to redirect my pages. All the pages would return to “/”. And the search engines can’t detect some pages I need.
I want to redirect all the other pages to “https://misaka-fans.space” except some pages I want such as ** /about ** , ** /imgboard ** …etc.
So what should I do?
Hi @misaka-fans, thanks for the post.
Based on the information on the order of processing of redirects, note that the redirects engine will process the first matching rule it finds, reading from top to bottom. More information can be found at the link below.
Based on your requirements, the pages you want to exclude should be at the top and then all other pages should be last in order for all other pages to redirect to “/”
Hope the above helps.
Thanks.
I don’t want these pages to be redirected, I can’t find how to prevent a page from being redirected in the documentation. It only tells me how to direct a page to another.
Hi @misaka-fans thanks for the feedback.
The reason all pages return to “/” is because of the from = "/*"
rule.
It means redirect all pages to “/”.
It’s a wildcard.
Only add pages that you want to redirect in the netlify.toml
file.
Let me know if the above helps.
In case it does not help with what you want to achieve, kindly go into further details what you actually want to achieve.
Thanks.
I want to direct all the pages (including pages that does not exist ) to https://misaka-fans.space/
except “/about”.
What should I do?
You can use the code force = true
which ensures that even non-existing pages are redirected like you listed above… Then add conditions = {Path: "!^/about"}
condition excludes the “/about” page from your redirects.
I found the cause. The “:” should be changed into a “=”.
But the problem still exists. When I refresh the “/about” pages, it returns 404.
Caused by Vue? How could I solve it?
Redirects don’t support exceptions as far as I know. The above syntax is incorrect.
In any case, this is what happens with SPA, you won’t get SEO. You can try to use pre-rendering, or use a static site generator like Nuxt.