Results 1 to 5 of 5

.htaccess index 301 redirect

This is a discussion on .htaccess index 301 redirect within the Off-Topic & Chit Chat forums, part of the Focus on Members category; If I wanted 301 redirect the index page of a domain ( www.domain.com/ ) to another domain ( www.mysite.com/ ) ...

  1. #1
    Senior Member woostar's Avatar
    Real Name
    woostar
    Join Date
    Apr 2007
    Posts
    788
    Liked
    5 times

    .htaccess index 301 redirect

    If I wanted 301 redirect the index page of a domain (www.domain.com/) to another domain (www.mysite.com/) but allow everything else through (www.domain.com/images/pic.gif)... how would I do this via htaccess?

    ta
    2011 Average: 1 post every 5 seconds... 24/7

  2. #2
    Senior Member woostar's Avatar
    Real Name
    woostar
    Join Date
    Apr 2007
    Posts
    788
    Liked
    5 times
    oh I forgot to say that it must only be domain.com/ that redirects it's root directory as there are other domains parked on that account
    2011 Average: 1 post every 5 seconds... 24/7

  3. #3
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    169 times
    You can use the following code in .htaccess:
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} domain\.com
    RewriteRule ^$ http://www.mysite.com/ [L,R=301]

  4. #4
    Senior Member woostar's Avatar
    Real Name
    woostar
    Join Date
    Apr 2007
    Posts
    788
    Liked
    5 times
    Lovely job, thank you Oleg
    2011 Average: 1 post every 5 seconds... 24/7

  5. #5
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,744
    Liked
    169 times
    You are welcome

Similar Threads

  1. redirect index.php-it
    By Baitona in forum URL Rewrite Settings
    Replies: 2
    Last Post: 06-23-2009, 02:11 PM
  2. Index as Redirect
    By LPH2005 in forum General Discussion
    Replies: 2
    Last Post: 05-31-2007, 01:32 PM
  3. Redirect Index.php to /
    By SalesPractice in forum URL Rewrite Settings
    Replies: 9
    Last Post: 03-28-2007, 10:14 AM
  4. Redirect index.php only if no query
    By voteforbird in forum Custom Rewrite Rules
    Replies: 1
    Last Post: 10-12-2006, 06:18 PM
  5. redirect to index.php in RC6
    By Thomas Hoehl in forum Bug Reporting
    Replies: 5
    Last Post: 08-26-2005, 12:49 AM

Posting Permissions

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