OctoberCMS Blog pagination content duplication issue - seo

I have used OctoberCMS blog plugin (https://octobercms.com/plugin/rainlab-blog) and it's working as per my expectations. However, I have one small issue..
My SEO tool (SEMRush - https://www.semrush.com/) telling me it's duplicate content .. how can I resolve this error?
http://mywebsite.com/rosterelf/blog
http://mywebsite.com/rosterelf/blog/1
My URL Structure for Blog Page - /blog/:page?|^[0-9]+$
As you can see, In blog listing, I have a pagination with "Next" and "Previous" links .. If I go to page 1 from page 2 then this kind of URL I am redirecting to http://mywebsite.com/rosterelf/blog/1 which obviously will have the same content as http://mywebsite.com/rosterelf/blog and thus my SEO Tool saying "Duplicate Content"
How can I solve this issue ?

OK Guys.. Eventually I did the following.
function onStart()
{
if(!empty($this->param('page')) && $this->param('page') == '1')
{
return Redirect::to('/blog', 301);
}
}
Here, I am just setting up 301 redirect .. so my SEO TOOLKIT doesnt crawl this page.
Thanks

Related

How to find broken links in a website using Cypress?

How can I find all broken links in a website using Cypress if there are any? Are there any plugins to use?
If not, how should I write my code that I can see whether the link returns a 200 status (or a successful link)?
Thank you!
Maybe this?
cy.request('yourlink')
.should((response) => {
expect(response.status).to.eq(200)
})
Try this...
for the first a selection a[href*="yourdomain.com"] the reason I didn't include "www" is because for my project we link to subdomains as well so I needed to include these.
for the second half, :not([href=""], again for my project we had links like this for some reason so I had to make sure to NOT include it.
$el.prop("href") fetches the href value from the DOM element.
I'm using cy.request() to send a HTTP request to the URL and make sure that it returns 200 thus proving that the page exists.
Here's the code:
cy.get('a[href*="yourdomain.com"]:not([href=""])').each(($el) => {
cy.request($el.prop("href")).as("link");
});
cy.get("#link").should((response) => {
expect(response.status).to.eq(200);
});
You can use this for any page. You can have your pages listed out in your cypress.json file or you can do it programatically as a regression test.
Here's the simplest way to do it:
cy.request("yourLink")
Yes, no need to add any assertions. because by default there's an assertion that the response is not 404. so this line is more than enough.
If you want to go the extra mile and test all the links in the page, here's what to do:
cy.get('a').each(link => {
cy.request(link.prop('href'))
})
This should make a request to all the available links with a tag in the page.
cy.visit(link)
cy.get('a').each(page => {
cy.request(page.prop('href'))
})

Stencil redirect after login

Is there a good way to redirect to a specific page using Stencil right after logging in? It defaults to the my account, but want to send to main shop page. I know login.php?from= works, just not sure how to enforce that and looking for a better way.
I'd recommend a javascript redirect based on the referring URL, though it isn't ideal. There isn't a store setting to accomplish this.
if (document.referrer !== "http://www.stackoverflow.com") {
window.location.href = "http://www.google.com";
}
There are alternative scripts to accomplishing this that can be found if you look for "redirect by referring url" or "redirect based on previous page".

error 301 versus 410 when page deleted

before when I deleted a page, I was them redirected (301) this page to the category page, but in google webmastertool, it said that I had too many "soft 404"
so recently I changed this and send a 410 error and display some links to similar page, but now in webmastertool, it said that it found an increase of "404 not found"
what to do ??
Of course they see an increase of 404 errors because that is what is happening! They warn you so that you notice unintended problems. But right now the increase is indeed intended so just ignore it. The warning will disappear.
The only thing you can do to not get people hitting deleted pages is to:
Stop deleting pages.
Clear out any links which may be leading to a deleted page.
If pages get deleted and links not removed then you'll be getting not found errors. Of course you can't avoid this if people are bookmarking your pages.
if you don't want to see 404 error is to redirect this to the related pages but keep in mind that excessive use of redirects is also harm full.Try not to delete more pages and try to remove your links of this page or try to reduce the link and wait and ignore the 404 for this page as time pass it will be go down in google search results and you get know 404.

Yii how to redirect to particular URL

I have used url beautifier to remove index.php?r= from URL. it works fine.
now i want user to redirect to URL if user hits particular url.
suppose
http://localhost/xm/xmds.php?wsdl
To
http://localhost/xm_demo_menu/WebService/service
how to achieve this. i search lot on google but not found material relevant to my problem
any suggestions ?
I do not see where the problem should be. See documentation
In you controller, simply call:
$this->redirect("http://localhost/xm_demo_menu/WebService/service");

Apache rewrite for 404: getting the requested url

On my error page that I redirect to for any 404s, I'd like to record the url that the user tried to get to.
I've tried this but it doesn't work:
ErrorDocument 404 /error/?url=%{HTTP_REFERRER}
Can anyone tell me how to do it?
Try it with %{REQUEST_URI}. I'm not certain this will work in ErrorDocument since I've never tested it, but it's worth trying.
ErrorDocument 404 /error/?url=%{REQUEST_URI}
There isn't a direct way. Nor a perfect one. But there are few workarounds with PHP.
For example, I currently use a function to create the links of each page. So I would just need to add file_exists() to the main function (few lines in a single function).
This is the function I would use to create urls:
function url ($Value)
{
// Do some stuff with the url
// [Not showed]
if (!file_exists("/internal/path/".$Value))
{
// Call a function to store the error in a database
error ("404", $Value);
// One way of handling it. Replace '/' for ' ' and search that string.
// Example: "path/to/page" would become "path to page".
$Value=str_replace("/","%20",$Value);
return "http://www.example.com/search=".$Value;
}
else
{
// If the page exists, create the normal link.
return $FullUrl;
}
}
This is my regular way of creating an urls:
<?php url('path/to/page'); ?>
I just thought about this method. It's great as it allows you to find missing pages even IF the user doesn't click on the links. Thank you for making me think about it and now I'll use it in my page (:
Another 'simpler' method (in case you do not wrap links) is that you store last couple of pages visited in $_SESSION['lastpage']; and $_SESSION['lastlastpage'];, if 404 is found then store the corresponding page from which the user tried to access the broken page. It's not a perfect solution since you have to manually find the broken link in the previous page, but at least it gives you some idea of where it is.
Disadvantage: As you can see, both solutions ONLY work with internal broken links.
It would seem there isn't a way.