Weird redirect between 2 subdomains

I’m trying to update my .htaccess as follows…

old url: http://piesyearly.com/

Read More

new url: http://yearly.pies.com/

these both live in the following file structure:

/public_html
htaccess.txt
../domains
../../piesyearly -->piesyearly.com
../yearlysubdomain -->yearly.pies.com

i’ve tried adding this to header.php of the old site, but it redirected every link to the homepage and not it’s respective path at the new domain:

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://yearly.pies.com");

i’ve tried to modify my htaccess.txt as well, but nothing changed:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^piesyearly.com$ [NC]
RewriteRule ^ http://yearly.pies.com%{REQUEST_URI} [L,R=301,NE]

obviously very confused here.

Related posts

1 comment

  1. if the sub-paths on the two sites are identical, then simply do this at the Apache level:

    RedirectPermanent / http://yearly.pies.com/
    

    Sub-urls will be properly sent over to the identical suburl on the new domain name. No need for any rewriting, since it’s a basic/simple 1:1 mapping.

Comments are closed.