MOSTAGHASSI
asked on
Redirect 301 from one address to another
Hello;
I want redirect the page details.php with its URL parameters to page hdetails.php:
redirect to:
thanks
I want redirect the page details.php with its URL parameters to page hdetails.php:
mydomain.com/health/details.php?articleid=8122&parentid=65&catid=87
redirect to:
mydomain.com/health/hdetails.php?articleid=8122&parentid=65&catid=87
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Julian,it works very well.
ASKER
Thanks Ray for your comment and solutions.
The important difference between a 301 and a 302 will appear when you look at the SEO statistics.
For anyone coming to this question in the future, the accepted solution is missing a question-mark before the query string in Option 2.
For anyone coming to this question in the future, the accepted solution is missing a question-mark before the query string in Option 2.
If you really want 301 moved permanently instead of 302 found, you need to send the 301 header redirection code in PHP. PHP has its own ideas about your intention, and its assumption is that you really want a 302 instead of a 301.
You may also want to consider whether you want HTTP or HTTPS, but if you're redirecting within the same domain, that should happen automatically.
Open in new window
You might be able to do it this way (I've never tested it)
Open in new window
Refs:
https://en.wikipedia.org/wiki/HTTP_301
https://en.wikipedia.org/wiki/HTTP_302
http://php.net/manual/en/function.header.php