0

I am redirecting my URL to https with htaccess using this directives:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoled.com/$1 [R=301,L]

It works Ok.

I need to do the same except with 127.0.0.1 while I develop PHP on XAMPP, so I added this condition:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} !^127.0.0.1
RewriteRule ^(.*)$ https://www.yoled.com/$1 [R=301,L]

But it continues sending the URL to https://www.yoled.com instead of using 127.0.0.1/index.php.

How can I set a RewriteCond for 127.0.0.1?

Thank you.

YOLED
  • 1
  • Not seeing the issue. Suggest trying to get some insight. See: [How to debug Apache mod_rewrite](https://stackoverflow.com/questions/9632852/how-to-debug-apache-mod-rewrite) – ficuscr Sep 30 '20 at 21:31
  • Make sure you are not looking at a cached result from earier attempts. Always test using an anonymous browser window. – arkascha Oct 01 '20 at 07:11
  • Asking for cached results? Really? - Tested on Firefox and Chrome. - Erased all navigation data with Ctrl+Shift+Delete in both browsers. - Used !^127.0.0.1 and !127.0.0.1. - Erased all .htaccess content setting just this segment. - I've try at beginning of .htaccess. - I've try at end of .htaccess. The RewriteCond is not working for 127.0.0.1, and in LOCAL XAMPP redirect to Web page on Internet. – YOLED Oct 04 '20 at 15:43

0 Answers0