Hi,
What seems to be an easy redirect turns out to be something I just can’t find online.
I want to move to another domain. So I created an redirect in my .htaccess:
redirect 301 /old-page https://newdomain.com/new-page
The redirect works but the url ends up https://newdomain.com/new-page?q=old-page
I just don’t understand why ?q= is added and how to remove it.
Googling for 3 hours, could not find nor the cause or the solution.
Hope you guys can help.
Kind,
Ilja
Maybe instead of
redirect 301 /old-page https://newdomain.com/new-page
try using something like this:
RewriteRule ^old-page$ https://newdomain.com/new-page [R=301,L]
Thanks, this is working.
Can you explain why the other method adds the strange ?q= variable?
I’m not quite sure.
The q
request variable gets added on this line
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
and is necessary for MODX to work correctly.
And apparently this line still gets executed even after a matching redirect 301 ...
rule.
1 Like
Ok, that’s seems to be the problem then.
Wondering if it’s by design or not.
Any way, thank, I will redirect by your method now.
system
Closed
December 9, 2022, 12:52pm
6
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.