1

How to make redirection on WordPress site with .htaccess to redirect this:

http://www.my-site.com/page/n

to home page:

http://www.my-site.com/

I do not wish to list previous post on site on first page of site, I removed paginated links from bottom of index.php but it is possible to open those pages typing address in browser location bar, or to find already indexed links by search engines...

closed as off-topic by fuxia Aug 18 '14 at 9:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2

It looks as though what you're asking is to redirect /page/n to the homepage, this can be accomplished with the RedirectMatch directive.

So:

RedirectMatch 301 ^/page/(.*) http://www.my-site.com/ 

would redirect all traffic from /page/n to the homepage.

  • Will this redirect just my-site.com/page/n to home page of site or it might redirect category, archive or any other paged url to site home? Any possible issues with it? – Advanced SEO Aug 15 '14 at 18:05
  • This will redirect all URL's after /page/ to home. You probably just want to use redirect 301 and specify exact pages if you don't want to redirect all. – Howard E Aug 15 '14 at 18:41
  • How I can specify all possible home paged URLs like www.my-site.com/page/n in .htaccess to prevent redirecting any category paged links like www.my-site.com/category/name/page/n to home page? – Advanced SEO Aug 15 '14 at 19:22
  • I just find a bug in your redirection rule above. It also redirect search result URL like this site.com/page/2?s=keyword to site.com/2?s=keyword (first page of search results). Can you fix that? Thanks @HowardE – Advanced SEO Jun 4 '15 at 10:44
1

.htaccess is ok but I often like the convenience of using a plugin for this stuff. I like Redirection most, it also supports regular expressions.

The regexp ^/page/(.*) will match stuff like page/n and it won't match category/name/page/n. You might want to learn more about regexes if needed.

  • So, it is safe to use it just to redirect www.my-site.com/page/n to www.my-site.com/, it will not redirect any other pages to home page? – Advanced SEO Aug 15 '14 at 21:30
  • Yeah just give it a try, either with .htaccess or the Redirection plugin. Test it and see if it works as expected. – guaka Aug 15 '14 at 21:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.