troubleshooting Question

Does This Code Qualify as OK for 301 Redirect --> Positive Google SEO?

Avatar of oaktrees
oaktrees asked on
Web DevelopmentSearch Engine Optimization (SEO)PHP
22 Comments2 Solutions259 ViewsLast Modified:
Need to get our website to resolve to our secure pages.

Seems like the best way, in terms of SEO, is via a 301 redirect.

Would this code be a 301 redirect?

if($_SERVER['HTTP_X_FORWARDED_PROTO']=="http"){
header('Location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
exit;
}

Or, will this be looked at as, not only NOT 301, but somehow seemingly the WRONG way to achieve our goal and result in a SEO penalty?

Many thanks!

OT
SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 22 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros