How to enable .htaccess for our plugins?

shazde

Active Member
May 19, 2014
29
0
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?
 

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
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.
 

shazde

Active Member
May 19, 2014
29
0
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
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.
 

shazde

Active Member
May 19, 2014
29
0
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
/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.
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.
 

shazde

Active Member
May 19, 2014
29
0
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
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 [email protected] 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.