I found this little trick http://css-tricks.com/snippets/htaccess/301-redirects/ to redirect my old Wordpress domain to my new domain with the path included. I run a test on my local copy and everything works fine. When I log in to the cpanel of the old domain and try it though it gives me some bad results.

Here is the code I used for both my local and live copy ...

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Redirect 301 / http://newsite.com/

Here's what the results look like http://www.cuponsmercado.com.br/lojas/. It looks to be calling the new domain (based on the Google Chrome status at the bottom left) but it just shows the old domain with broken HTML/CSS. Any Ideas?

2 Answers 2


Replace Redirect 301 / http://newsite.com/ by RewriteRule ^(.*)$ http://newsite.com/ [L,R=301]

  • Please add an explanation to your answer: why could that solve the problem?
    – fuxia
    Dec 18, 2013 at 20:13

Move your redirect up above the WordPress section.

As it looks to me, what should be happening is that .php files are processed as normal on the old domain. See that [L]? That is going to be the last rule ran, if the conditions match. The redirect never applies to those files. It does apply to non-php files-- images, javascript, etc. And if you watch your requests with something like HttpFox it confirms the description I just gave.

I'd do this with a CNAME if I were you though.

  • I tried a couple different solutions including that (stackoverflow.com/questions/20576478/… ). I haven't had luck with anything. If the redirect were to work wouldn't it just use everything on newsite.com (images, javascript)? I'll look into doing it with CNAME, I've never had this not work before though.
    – Ryan Grush
    Dec 13, 2013 at 22:26
  • It isn't just about whether what you are trying will work, it is about the efficiency of the solution. A CNAME "redirect" should be more efficient. As is, you are making a request to one server only to be told to make a request to another one.
    – s_ha_dum
    Dec 13, 2013 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.