Home Too many redirect with pagination query string
Reply: 2

Too many redirect with pagination query string

mmrs151 Published in 2017-12-07 00:49:23Z

I am trying to redirect pages

From: mysite.com/cata/catb

To mysite.com/cata/catb?p=1

But it is ending up with so many p=1

i.e mysite.com/cata/catb?p=1?p=1?p=1?p=1?p=1?p=1?p=1?p=1?p=1

My .htaccess is

redirect 301 ^/cata/catb$ /cata/catb?p=1

Can someone please tell me what is wrong here.

Allan Reply to 2017-12-07 01:57:11Z

I have the feeling that your redirect 301 ^/cata/catb$ /cata/catb?p=1 redirect regex applies only on the path path of your URL and ignores your ending parameters ?p=1

Therefore the redirection is done in a kind of recursively manner:

/cata/catb → /cata/catb?p=1
/cata/catb?p=1 → /cata/catb?p=1?p=1
/cata/catb?p=1?p=1 → /cata/catb?p=1?p=1?p=1

Could you try changing your

redirect 301 ^/cata/catb$ /cata/catb?p=1 in redirect 301 ^/cata/catb$ /cata/catc?p=1 and check the output?

or adding a trailing "/"to your path -> /cata/catb/?p=1 even if it is far from being sexy.

You might also be interested by the following commands RedirectMatch and RewriteEngine on:


Good luck!

anubhava Reply to 2017-12-07 07:38:36Z

Your code is redirecting /cats/catb to the same directory/file that is why you are getting the loop error. To fix this, you need to use mod-rewrite and a RewriteCond that excludes the destination Query String.

Try :

RewriteEngine on

RewriteCond %{QUERY_STRING} !^p=1$
RewriteRule ^cata/catb/?$ /cata/catb?p=1 [L,R]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31117 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO