PHP redirect from Old Domain to New Domain

June 26, 2011 at 21:18:33
Specs: N/A
Hi all,

I've been looking on the net and have not been very successful with a guide on how to do a 301 redirect from old page to new page for the below two scenarios. There is a PHP query in it.

I tried this but it didn't work.
Redirect 301 http://www.olddomain.com.au/index.php?pageid=oldpagename1
TO
http://www.newdomain.com.au/newpagename/

Scenario 1
http://www.olddomain.com.au/index.php?pageid=oldpagename1
TO
http://www.newdomain.com.au/newpagename

Scenario 2
http://www.olddomain.com.au/index.php?pageid=oldpagename2
TO
http://www.newdomain.com.au/newpagename/subpagename

Appreciate if someone could help.

Thanks a lot!!!


See More: PHP redirect from Old Domain to New Domain

Report •


#1
June 29, 2011 at 02:25:38
"what" you are trying to write is correct but I doubt "Where" you are writing.
This code has to be written in header tag.

Since you are trying to redirect a page, either you write it in .htaccess file (code different than what you have posted and requires mod rewrite on) or use a plugin such as "redirection" plugin, which is more user friendly


Report •

#2
June 29, 2011 at 02:31:19
one more thing, probably you are trying to make user friendly permalinks I guess.
better to change that first on wordpress settings itself and then figure out what redirect you actually require.

Report •
Related Solutions


Ask Question