I’m trying setup a bunch of 301 redirects for a newly rebuilt site. So I add this to the .htaccess:
Redirect 301 /company-overview /about-name-group
And I get this a 404 with this new url:
https://namegroup.com/about-name-group?q=company-overview
I’ve tried various formats, full url, relative url, with .html extension without, all with the same result.
I’ve searched the forum here and found others with a similar problem, but they fixed it using a rewrite vs a redirect. This is not the same for SEO purposes.
Others mentioned they used an extra for redirects with the same issue.
I’m assuming this is due to the the rewrite code in the .htaccess which modx requires, but I have no idea how to deal with this.
Modx 3.0.5
If you use a RewriteRule with [R=301,L]
, I don’t think there is any difference (regarding SEO) and it should work (without adding a q
parameter).
RewriteRule ^somepage\.html$ otherpage.html [R=301,L]
Halftrainedharry
Thanks for looking at this.
I didn’t know that is the same as far as SEO is concerned. I can try it.
However, don’t understand why the standard redirect isn’t working. I’ve used this on many sites without an issue.
It seems that the RewriteRule (RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
) and the Redirect 301 are both applied at the same time.
Generally, the internet says that “you shouldn’t mix mod_alias
rules with mod_rewrite
”.
Just to follow-up
That rewrite example didn’t work either. So I decided to try the cpanel tool to generate a redirect. This added the following to the bottom of the .htaccess file.
RewriteRule ^company\-overview\.html$ "https\:\/\/jbwgroup\.com\/about\-jbw\-group\.html" [R=301,L]
This didn’t work either. So I chatted with tech support and after a far too long discussion, they told me to move it to the top of the file where it now works correctly.
They told me that the Modx directives prevent this from working at the end of the file.
While this seems like an overly complex rewrite to me, for a simple redirect, I guess it gets the job done.
I appreciate your help–as always.
Thank you.