I have domain.com. If the user is logged in, it should load automatically domain.com/option-X where X is a predefined choice of the user.
So, I do this at the top of index.php:
header("Location: /option-X");
But, if the user is not logged in, I just choose automatically the first option like this:
header("HTTP/1.1 301 Moved Permanently"); header("Location: /option-a");
So, i have two questions regarding the implications of doing so:
A 301 signals a permanent redirect from one URL to another, meaning all users that request an old URL will be automatically sent to a new URL. A 301 redirect passes all ranking power from the old URL to the new URL, and is most commonly used when a page has been permanently moved or removed from a website.
Never use 302 redirects or meta refresh redirects for permanent redirects. 302 redirects are for temporary moves, and Google recommends not to use meta refresh redirects at all if possible. So, if you have either of these on your site, you should aim to either remove them or replace with 301 redirects.
The HyperText Transfer Protocol (HTTP) 301 Moved Permanently redirect status response code indicates that the requested resource has been definitively moved to the URL given by the Location headers. A browser redirects to the new URL and search engines update their links to the resource.
The effect of the 301 would be that the search engines will index /option-a instead of /option-x. Which is probably a good thing since /option-x is not reachable for the search index and thus could have a positive effect on the index. Only if you use this wisely ;-)
After the redirect put exit(); to stop the rest of the script to execute
header("HTTP/1.1 301 Moved Permanently"); header("Location: /option-a"); exit();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With