dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: .htaccess redirect to new site

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    2

    .htaccess redirect to new site

    Hi,
    I've recently got a new domain with the same hosting company.
    I have moved all files etc to the new domain and the site works great.
    I've been trying to get the redirection working from old site to new site.

    I've edited the .htaccess file to include the following:
    Options +FollowSymLinks

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    RewriteRule ^(.*)$ http://www.newdomain.co.uk/$1 [R=301,L]

    I put this on the hosting for the old domain. This only seems to redirect pages in the root directory. I have a store located in www.olddomain.co.uk/store/ which i'd like to be redirected to www.newdomain.co.uk/store/ but for some reason this does not happen.

    All the file/folder structure is the same.

    Thanks in advance

  2. #2
    Join Date
    Mar 2011
    Posts
    26
    This should work

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=permanent,L]

    I found it here, the guy originally used to to just redirect domain.com to www.domain.com

    http://www.cyberciti.biz/faq/apache-...-wwwdomaincom/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles