How to Do 301 Redirect on This Case? Plz Help.

Create ".htacces" file inside root site folder which contains:
I did mistake filename is ".htaccess" but not ".htacces"
Try this:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>

RewriteCond %{QUERY_STRING} ^_page=[0-9]+
RewriteRule (.*) / [QSD,R=301,L]
 
I did mistake filename is ".htaccess" but not ".htacces"
Try this:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>

RewriteCond %{QUERY_STRING} ^_page=[0-9]+
RewriteRule (.*) / [QSD,R=301,L]
Oh yeah bro, this one works perfectly. All those regex URLs are redirected to the home page.

Any idea of why have so many regex home page urls also indexed in Google? Never created these different home pages, but looks like they are old draft versions saved while I was in the process of creating the home page.

thanks so much for help.
 
Anybody can open URLs like:
Code:
https://www.google.com/?test=1
https://www.google.com/?test=2

These page are the same, but have different URL.

You may scan your website using "Screaming Frog". May be some page have these links:
Code:
mydomain.com/?_page=1
mydomain.com/?_page=2
mydomain.com/?_page=3
mydomain.com/?_page=4
 
If you can't go with 301 simply make it 410. Google now take care of 410 redirect. Also 301 in not a best practise now a day's.
 
If those pages don't have traffic, simply remove them, temporary you get a fall in traffic but eventually fine in the long run.
 
If you can't go with 301 simply make it 410. Google now take care of 410 redirect. Also 301 in not a best practise now a day's.
Just did a bit of research on 410 redirections when I saw ur comment and sounds like a good solution.
tbh, i never heard and used 410 redirections before, thanks bro.
 
If those pages don't have traffic, simply remove them, temporary you get a fall in traffic but eventually fine in the long run.
yeah, but the problem is i am not sure how many these regex urls do exist there, so not sure how to bulk deindex or remove these urls.
With a few lines of codes in htaccess, i can redirect all these regex urls to a single destination.
thanks bro
Are you using any latest post block with pagination
You are right, bro! I do use post block plugin to layout my posts on home page and category pages.

Do u think the post block with pagination plugin causes this problem? thanks bro
 
Do u think the post block with pagination plugin causes this problem? thanks bro
Yep, that's what's causing it. It can't be removed. And 301ing the pagination pages will only hurt your website. Let them get indexed. Sometimes these pages help to bring in extra traffic.
 
Yep, that's what's causing it. It can't be removed. And 301ing the pagination pages will only hurt your website. Let them get indexed. Sometimes these pages help to bring in extra traffic.
thanks a lot bro, and u are right, and I did a bit of research on this, and all those regex urls are from home page pagination.
So, I removed the pagination on the home page, then redirected all those pagination pages to mydomain.com.

Dont think we need pagination on the home page, so I will see how this impact my SEO from now on.

thanks again bro!
 
That code that they share with you is very good, with one line you already do everything in one.

But if in any case you get stuck, excell is a very good help to do bulk actions. For example, 301 redirects.
 
To properly set up a 301 redirect for the URLs with "/page/1", "/page/2", etc., to your homepage "mydomain.com", you can use the following method:

1. Access your website's .htaccess file (if you're using an Apache server) or your server's configuration file.

2. Add the following lines to redirect all URLs with "/page/*" to your homepage:

RewriteEngine On
RewriteRule ^page/.*$ https://mydomain.com [R=301,L]

3. Save the changes to your .htaccess file.

This will instruct the server to redirect any URLs with "/page/1", "/page/2", etc., to your homepage "mydomain.com" with a 301 (permanent) redirect status.

Make sure to test the redirects after implementing them to ensure they are working correctly. Additionally, it's a good practice to monitor your website's indexing status in Google Search Console to verify that the unwanted URLs are no longer being indexed.
 
Back
Top