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!

How to enable .htaccess for our plugins?

Discussion in 'cPanel Developers' started by shazde, Jun 21, 2018.

Tags:
  1. shazde

    shazde Active Member

    Joined:
    May 19, 2014
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,

    For a new plugin, I need to have all URLs to be redirected to our index.cgi file.
    To achieve this I uploaded an htaccess file our plugin directory but that didn't work and unfortunately, I can't find the apache configuration file for WHM service.

    1. Does WHM run under Apache?
    2. If yes where is the config file located?
    3. If not how can I make sure all URLs under for my plugin are redirected to a single index.cgi file?
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,888
    Likes Received:
    90
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    No, WHM works differently not on Apache.
    You can create index page and meta tags for redirection to the URL of your choice or file of your choice if .htaccess is not working as expected for you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @shazde,

    The Web Host Manager interface does not utilize the Apache web server that your websites use. Have you tried configuring the redirect in the script itself? Here's a StackOverflow discussion you may find helpful:

    How to redirect from one CGI to another

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. shazde

    shazde Active Member

    Joined:
    May 19, 2014
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    The CGI header redirect won't help us here.

    What we want to achieve is to have:

    /our-plugin/none/existing/path to redirect to /our-plugin/index.cgi then our plugin is going to look into the request path and decide how to handle it.

    The goal is to have a single cgi file per plugin that can handle all requests to that plugin.
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @shazde,

    Can you provide some more information on why you'd need to utilize paths or links that do not exist? For instance, if the plugin is accessible through Web Host Manager, under what scenario would someone access the wrong directory or URL?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. shazde

    shazde Active Member

    Joined:
    May 19, 2014
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    We do not want to have separated CGI files for every single page that our plugin needs to support.
    It would be great if we can have something similar to mod_rewrite here.
     
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @shazde,

    Can you provide a CODE example and step-by-step instructions of how we can reproduce the issue you are describing when setting up a WHM plugin?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. shazde

    shazde Active Member

    Joined:
    May 19, 2014
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,

    Our code is Golang and we want WHM server to perform as below:

    Assuming we have index.cgi under our CGI directory. we want /index.cgi/path1/path2 also call /index.cgi rather than displaying a 404 error.
     
  9. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,142
    Likes Received:
    1,932
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @shazde,

    I'm not aware of any methods you could use to implement those rewrite rules in a WHM plugin. You could send an email to integration@cpanel.net explaining the situation to see if any of our Developers can share some insight into how you might implement that with your plugin.

    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