Results 1 to 3 of 3

Thread: .htaccess redirects

  1. #1

    Thread Starter
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    .htaccess redirects

    I've added the following into my .htaccess

    Code:
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^oldurl.com [NC] 
    RewriteRule ^(.*)$ http://www.newurl.com/$1 [L,R=301]
    Where I want to redirect all pages from the old domain to the new domain e.g. www.oldurl.com/example.htm should redirect to www.newurl.com/example.htm

    However nothing happens! Is there any syntax wrong?

    Is it possible for me to find out if the rewrite engine is turned on - host says it is!

    Cheers

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: .htaccess redirects

    www.oldurl.com is not the same as oldurl.com.

    The easiest way is to negate the expression:
    Code:
    RewriteCond %{HTTP_HOST} !^([a-z\.]+\.)?newurl.com$
    RewriteRule ^(.*)$ http://www.newurl.com/$1 [L,R=301]
    That should match any domains that are not newurl.com or a subdomain of it (or sub-subdomain, etc.).
    Last edited by penagate; Oct 23rd, 2007 at 10:13 AM.

  3. #3

    Thread Starter
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: .htaccess redirects

    Great works perfectly - thanks for all your help!

    If I have been helpful please rate my post. If I haven't tell me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width