cPanel setredirecturl api function
Hi,
I'm having a tough time figuring out how to set the redirect URL for a domain I've just parked. I don't seem to be able to do it via the API (v2) when parking the domain, and the only other function that seems to do this is Park::setredirecturl in v1 of the API. But I can't for the life of me figure out how to format the command line to work properly. I'm calling it from Perl using LWP to send a GET request and my URL looks like this:
"
-
Hello, You might find the following UAPI functions helpful for this purpose: UAPI Functions - Mime::list_redirects - Software Development Kit - cPanel Documentation UAPI Functions - Mime::delete_redirect - Software Development Kit - cPanel Documentation UAPI Functions - Mime::add_redirect - Software Development Kit - cPanel Documentation This will allow you to list the current redirect for a domain alias (parked domain), delete it, and add a new one with the URL of your preference. Using the UAPI command-line functionality as an example, let's say "cptest02.tld" is our alias. We can obtain information such it's target URL and current document root if a redirect already exists via a command such as: uapi --user=$cpanel-username Mime list_redirects
Then, if a redirect exists for this domain name, it's possible to delete it via a command such as:uapi --user=$cpanel-username Mime delete_redirect domain=cptest02.tld docroot=/home/$cpanel-username/public_html
Finally, you can add the new redirect with a command such as:uapi --user=$cpanel-username Mime add_redirect domain=cptest02.tld redirect=http%3A%2F%2Fgoogle.tld%2F type=permanent redirect_wildcard=1 redirect_www=0
Let us know if this helps. Thank you.0
Please sign in to leave a comment.
Comments
1 comment