Changing rule url for Grafana alerting

I am trying to use Grafana alerting in which I want to change Rule URL. By default it redirects to localhost:3000 which I want to change to custom domain along with custom port number. How would I do that.
GF_SERVER_ROOT_URL: http://my_custom_ip:my_custom_port
i tried with this variable but still it redirects to localhost and default port i.e 127.0.0.1:3000