Score:0

Apache redirects - issue with redirects in query string

gp flag

I have lots of apache permanent redirects for site that look like this:

Redirect 301 /old-path      https://new.com/lang/new-path/?utm_source=old.lang&utm_medium=301

When the path doesn't match any old path, it redirects to root like this:

Redirect 301 /      https://new.com/lang/?utm_source=old.lang&utm_medium=301

As you can see, there has to be this part at the end of url:

?utm_source=old.lang&utm_medium=301

Problem

The issue is when i input old.com/test123 and it doesn't match any redirect in .htaccess file, it redirects to root (like it should) but adds the "test123" at the end of url, so it looks like this:

https://new.com/lang/?utm_source=old.lang&utm_medium=301test123

Instead of that, there should be a clean url like this one:

https://new.com/lang/?utm_source=old.lang&utm_medium=301

Am I missing something?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.