The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirect a file to a directory gives a loop?

Discussion in 'General Discussion' started by nunovieira, Aug 24, 2009.

  1. nunovieira

    nunovieira Registered

    Joined:
    Aug 24, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I pretend to redirect:

    http://asite.com/directory
    or
    http://www.asite.com/directory

    to

    http://asite.com/directory/index.php
    or
    http://www.asite.com/directory/index.php

    so that visitors only have to type
    http://asite.com/directory/
    or
    http://www.asite.com/directory/

    and be redirected to

    http://asite.com/directory/index.php
    or
    http://www.asite.com/directory/index.php

    I'm using .htaccess inside /directory/ and i have tried this:

    RewriteCond %{HTTP_HOST} ^asite.com/directory$ [OR]
    RewriteCond %{HTTP_HOST} ^www.asite.comt/directory$
    RewriteRule ^compras/indice.php$ "http\:\/\/www\.a site\.com\/directory\" [R=301,L]
    (gives a loop)
    and this:
    redirect /directory /directory/index.php
    (gives a loop)

    Your precious help would be much appreciated :D I'ts urgent..
    Tank you very much for your atention.
     
  2. MattCurry

    MattCurry Well-Known Member

    Joined:
    Aug 18, 2009
    Messages:
    275
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Houston, Tx
    Loop

    Hello,


    If this is urgent please submit a ticket so we can look at it immediately, and in this case we would need to get more info already anyways. Please submit a ticket via the link below. Hopefully we can get it resolved for quickly.

    Thank you,
    Matthew Curry
     
  3. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,476
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    There have been several threads recently about a redirect loop problem, here's one of them. http://forums.cpanel.net/f34/redirect-loop-118985.html

    That said, I'm not sure why you're wanting to create a redirect to something that your server should already be able to handle.

    This:

    http://asite.com/directory
    or
    http://www.asite.com/directory

    Should already open to this:

    http://asite.com/directory/index.php
    or
    http://www.asite.com/directory/index.php

    Or this:

    http://asite.com/directory/index.html
    or
    http://www.asite.com/directory/index.html

    ...normally, without a redirect.
     
  4. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    I agree with Infopro on that. However, if you have multiple index files in that directory then you can just put the following entry in the htaccess file in that directory :

    Code:
    DirectoryIndex index.php index.html
     
  5. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Uhm, to the original poster --- very lousy example!

    For everything you posted, you don't need any redirects whatsoever !!!!

    You don't need to setup anything !!!

    Those already are the addresses of everything you typed by default!

    When you don't specify a filename on a URL, the index files are automatically
    displayed when included by default "index.php" which is precisely what you
    used in every single one of your examples.

    Thus, all of the following are the same:

    http://domain.com/folder
    http://www.domain.com/folder
    http://domain.com/folder/
    http://www.domain.com/folder/
    http://domain.com/folder/index.php
    http://www.domain.com/folder/index.php
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,476
    Likes Received:
    202
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Easy does it, it was posted in the new users section of the forums. ;)
     
Loading...

Share This Page