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?
 

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

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
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.
 

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

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
/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

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
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 [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.