How can I redirect an entire domain to just one webpage using .htaccess?

Jack Cola January 4, 2011

I have a domain/website that I want to redirect all URL’s to one page on another domain through .htaccess.

Example: to redirect to (that’s what I have know)
But I also want to redirect$ to redirect to (where the $ is any page).

Basically, any page visited to should be redirected to


  1. Jack Cola
    January 7, 2011 at 12:40 am

    Thanks Mike,

    I have found a cleaner piece of code that works really well now.

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) [R=301,L]

    • Aibek
      January 10, 2011 at 8:34 am

      thanks for an update Jack!

  2. Mike
    January 6, 2011 at 3:16 pm

    Example using htaccess:
    Redirect 301 /

    Example using mod_rewrite:
    RewriteEngine On
    rewritecond %{http_host} ^
    rewriteRule ^(.*) [R=301,L]

    As for the htaccess redirect the new pages must not be in a subdirectory of the htaccess file. But if you are on a different host/account this won't concern you.

    • Jeff
      November 23, 2011 at 4:42 am

      Jack, works perfect for me! Thanks man!

  3. Jack Cola
    January 6, 2011 at 3:33 am

    I have solved my issue, but I am sure there is a better, more efficient way.

    My .htaccess file contains:

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^$ [OR]
    RewriteCond %{HTTP_HOST} ^$
    RewriteRule ^/?$ "" [R=301,L]

    ErrorDocument 404


    If you know have a cleaner way, please let me know