301 redirect not working through .htaccess

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 …

Read More
# 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]
</IfModule>
# 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?

Related posts

2 comments

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

  2. 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.

Comments are closed.