how to redirect "/" to "something-else.html"

12 replies
hi,
I am trying to redirect my homepage "www.mysite.com" to "www.mysite.com/something-else.html"

i have found nothing at google so please help me with it.

This is my current .htaccess file

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([a-z]+\.com) [NC]
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
RewriteRule ^index.html http://www.mysite.com/ [R=301,L]

and i want to redirect everything to www.mysite.com/something-else.html

Thank you.

Amir
#redirect #somethingelsehtml
  • Profile picture of the author phpg
    If you want to redirect homepage ONLY, put this on the next line after RewriteCond:

    RewriteRule ^index.html http://www.mysite.com/something-else.html [R=301,L]

    If you want to redirect everything, put this on the next line after RewriteCond:

    RewriteRule .* http://www.mysite.com/something-else.html [R=301,L]
    {{ DiscussionBoard.errors[6020881].message }}
  • Profile picture of the author Terry Jett
    If you are using a host with cpanel, take a look at "Redirects" under the Domains area. This will be the simplest.

    Terry
    {{ DiscussionBoard.errors[6021009].message }}
  • Profile picture of the author Rally Writer
    Are you using wordpress for this domain?
    You can do this by create wordpress blog at mysite.com/something-else using fantastico
    {{ DiscussionBoard.errors[6021272].message }}
  • Profile picture of the author SteveJohnson
    Originally Posted by amiramin View Post

    hi,
    I am trying to redirect my homepage "www.mysite.com" to "www.mysite.com/something-else.html"

    [...]

    and i want to redirect everything to www.mysite.com/something-else.html
    So which is it - just your homepage or 'everything'?

    If you just want 'something-else.html' as the home page, it's very easy. All this putzing around with mod_rewrite will only give you a headache. Put this in your root directory's .htaccess file:
    Code:
    DirectoryIndex something-else.html index.php index.html
    This simply tells Apache to deliver something-else.html as the 'index' file for the directory. Nothing more complicated is needed.

    If you truly want to redirect page requests to a single page, you can use RedirectMatch (faster and easier than concocting a rewrite):
    Code:
    RedirectMatch ([^.html]*).html http://mydomain.com/something-else.html
    which redirects only page requests (not image requests, stylesheets, etc.).

    Don't try to overcomplicate things

    ###NOTE####
    The stupid forum editor stripped out something very important in the RedirectMatch statement: instances of a full-stop (a period, or '.') must be escaped by a preceding backslash, like so: \.

    So you should have:
    RedirectMatch ([^\.html]*)\.html http://mydomain.com/something-else.html
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[6022013].message }}
    • Profile picture of the author amiramin
      Originally Posted by phpg View Post

      If you want to redirect homepage ONLY, put this on the next line after RewriteCond:

      RewriteRule ^index.html http://www.mysite.com/something-else.html [R=301,L]

      If you want to redirect everything, put this on the next line after RewriteCond:

      RewriteRule .* http://www.mysite.com/something-else.html [R=301,L]
      Originally Posted by SteveJohnson View Post

      So which is it - just your homepage or 'everything'?

      If you just want 'something-else.html' as the home page, it's very easy. All this putzing around with mod_rewrite will only give you a headache. Put this in your root directory's .htaccess file:
      Code:
      DirectoryIndex something-else.html index.php index.html
      This simply tells Apache to deliver something-else.html as the 'index' file for the directory. Nothing more complicated is needed.

      If you truly want to redirect page requests to a single page, you can use RedirectMatch (faster and easier than concocting a rewrite):
      Code:
      RedirectMatch ([^.html]*).html http://mydomain.com/something-else.html
      which redirects only page requests (not image requests, stylesheets, etc.).

      Don't try to overcomplicate things

      ###NOTE####
      The stupid forum editor stripped out something very important in the RedirectMatch statement: instances of a full-stop (a period, or '.') must be escaped by a preceding backslash, like so: .

      So you should have:
      RedirectMatch ([^.html]*).html http://mydomain.com/something-else.html
      well, above mentioned methods arn't working

      again it want to redirct my root www.mydomain.com to www.mydmain.com/google.html
      Signature
      movies
      SEO is Like Life, You can Plan it but You can't Control it.
      {{ DiscussionBoard.errors[6022932].message }}
  • Profile picture of the author amiramin
    anybody else
    Signature
    movies
    SEO is Like Life, You can Plan it but You can't Control it.
    {{ DiscussionBoard.errors[6030414].message }}
  • Profile picture of the author Earnie Boyd
    In index.html add

    <head>
    <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/google.html">
    </head>
    Signature
    {{ DiscussionBoard.errors[6030539].message }}
    • Profile picture of the author amiramin
      Originally Posted by Earnie Boyd View Post

      In index.html add

      <head>
      <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/google.html">
      </head>
      I want to redirect it through htaccess
      Signature
      movies
      SEO is Like Life, You can Plan it but You can't Control it.
      {{ DiscussionBoard.errors[6031209].message }}
  • {{ DiscussionBoard.errors[6031240].message }}
    • Profile picture of the author Stuart Macfarlane
      Hi,

      Too many people in this post don't understand how .htaccess works are are copy and pasting from Google.

      The correct method is to use the following:

      Code:
      Redirect 301 / http://example.com/
      If you have any problems getting this to work let me know and I will happily find out why your server is not executing redirects correctly.

      Kind Regards,
      Stuart Macfarlane
      {{ DiscussionBoard.errors[6032200].message }}
      • Profile picture of the author amiramin
        Originally Posted by Stuart Macfarlane View Post

        Hi,

        Too many people in this post don't understand how .htaccess works are are copy and pasting from Google.

        The correct method is to use the following:

        Code:
        Redirect 301 / http://example.com/
        If you have any problems getting this to work let me know and I will happily find out why your server is not executing redirects correctly.

        Kind Regards,
        Stuart Macfarlane
        Thank you Stuart,
        i have tried above mentioned but it isn't working.
        Signature
        movies
        SEO is Like Life, You can Plan it but You can't Control it.
        {{ DiscussionBoard.errors[6034122].message }}
        • Profile picture of the author Stuart Macfarlane
          Originally Posted by amiramin View Post

          Thank you Stuart,
          i have tried above mentioned but it isn't working.
          Ok so one of the following statements is now true:

          1) You need to add RewriteEngine On above the rule
          2) Your .htaccess override is not enabled in your servers config

          I would gladly take a free look in private and 100% fix this for you and provide instructions how I did it, Just drop me an Email, Skype or PM.

          Regards,
          Stuart Macfarlane
          {{ DiscussionBoard.errors[6035556].message }}

Trending Topics