Apache Redirect TO IP Address (non-URL)
Solution 1
I suspect that your Redirect line is in a part of the config file that affects both the SSL and non-SSL parts. Therefore, even when you request the SSL version you still get a redirect to the SSL version.
If you have a part of the config file that is for non-SSL only, move the Redirect there. If not, convert it to a RewriteRule and use a RewriteCond in front of it like this:
RewriteCond %{HTTPS} off
RewriteRule / https://100.100.100.100/ [R=301]
Solution 2
Apache has a special page titled "When not to use mod_rewrite"
Follow their examples
To redirect http URLs to https, do the following:
<VirtualHost *:80>
ServerName www.example.com
Redirect "/" "https://www.example.com/"
</VirtualHost >
<VirtualHost *:443>
ServerName www.example.com
# ... SSL configuration goes here
</VirtualHost >
Related videos on Youtube
wonderswan
Updated on September 18, 2022Comments
-
wonderswan over 1 year
I've been trying to redirect web traffic from HTTP to HTTPS by adding the line to the
httpd.conf
file:Redirect permanent / https://100.100.100.100
but to no avail. The browser response is
Firefox has detected that the server is redirecting the request for this address in a way that will never complete
.I understand that it works for domain names but my server doesn't use one. Is there any way around this/what am I doing wrong.
-
Mathias R. Jessen over 12 yearsHave you configured Apache to listen on port 443 and referenced an SSL certificate? Please post the host configuration from httpd.conf
-
Ladadadada over 12 yearsOne of the problems with using a permanent redirect is that Firefox will cache it. (Maybe not the redirect delivered over SSL but definitely the one delivered over non-SSL.) Even once you fix this problem, Firefox will continue to give you that error message until you clear that part of its cache. Use
curl -I http://100.100.100.100
to check what response code you get back without having to worry about caching. -
wonderswan over 12 years@JudasIscariot1651 Yes SSL certificate is installed and when I enter 'https://' 100.100.100.100' in browser it works no problem. I want 'http://' 100.100.100.100 to redirect to https://...
-