Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Redirect all files in a directory

Discussion in 'General Discussion' started by Kerrya, Dec 15, 2014.

  1. Kerrya

    Kerrya Registered

    Joined:
    Jul 27, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I'm having a problem with 301 redirects.

    I have a sub-directory that contains a forum that is no longer used. I want to redirect all hits on that directory back to the main root of the site.

    i.e. abc.com/my-directory/ > abc.com

    this only seems to work on the directory but not on the files in the directory.

    i.e. abc.com/my-directory/my-file.html does not redirect at all. It still goes to the original file

    If I use a wildcard redirect then this happens:

    abc.com/my-directory/my-file.html > abc.com/my-file.html

    Is there a way to redirect all links to that directory regardless of what file is specified?

    Any advice appreciated.

    Kerry
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,323
    Likes Received:
    1,851
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello :)

    You will likely need to implement some custom Mod_Rewrite rules in order to redirect those requests. You may want to post to the support forums of the previous script you were using to see what type of rules others might have utilized.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice