Dumb SEO Questions

(Entry was posted by Wilson Calaham on this post in the Dumb SEO Questions community on Facebook, 03/09/2014).

Hi friends, i want to do a 301 redirect with htaccess in joomla but I can`t get it to work

Hi friends, i want to do a 301 redirect with htaccess in joomla.
Both domains are on same host, the old one is parked on new one, no i want to make them point to new one.without loosing my 1000 pages of index in google with old domain.
I have tried this below code
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://wwwdotnewsitedotcom/$1 R=301, L
but it says
This web page has a redirect loop?
This question begins at 02:36:28 into the clip. Did this video clip play correctly? Watch this question on YouTube commencing at 02:36:28
Video would not load
I see YouTube error message
I see static
Video clip did not start at this question

YOUR ANSWERS

Selected answers from the Dumb SEO Questions Facebook & G+ community.

  • Wilson Calaham: Hi friends, i want to do a 301 redirect with htaccess in joomla.
    Both domains are on same host, the old one is parked on new one, no i want to make them point to new one.without loosing my 1000 pages of index in google with old domain.
    I have tried this below code
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www[dot]newsite[dot]com/$1 [R=301,L]
    but it says
    This web page has a redirect loop
  • Tony McCreath: That redirects to itself, hence a loop. You will need to qualify it with only redirecting from the old site. Add this on the line before the RewriteRule:

    RewriteCond %{HTTP_HOST}  ;^www.oldsite.com$ [NC]
  • Wilson Calaham: You mean i add below code in custom redirect block ?

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST}  ;^www.nfc-forum.ir$ [NC]
    rewriterule ^(.*)$ http://www[dot]banksupply[dot]ir/$1 [r=301,nc]
  • Tony McCreath: Looks right
  • Wilson Calaham: Not working, it does nothing
  • Tony McCreath: You're right, but it looks good. Is it at the start of the .htaccess file? An error before it or other command may stop it working.

    Strange as without the condition you were getting a redirect loop which implies the  ;command without the condition was working.

    You're obviously showing code altered for the public (like the [dot]s) so I would double check your exact code, test and try variations to see what you can get working. ;

    Your also missing the L flag in your rule which means subsequent rules may overwrite it. Here's a possible improvement:

    RewriteCond %{HTTP_HOST}  ;^.*nfc-forum.ir$ [NC]
    RewriteRule ^(.*)$ http://www[dot]banksupply[dot]ir/$1 [R=301,NE,NC,L]

    Replacing the [dot]s with dots (.).
  • Wilson Calaham: If possible plz send me an email or private msg so i can share my whole htaccess file with you my email is h.m.island[@]gmail.com
    I think i make mistake 

View original question in the Dumb SEO Questions community on Facebook, 03/09/2014).

All Questions in this Hangout