• 0

Help with Domain Name and IP Redirection


Question

Can someone help me with redirecting a domain name to the HTTPS version of itself?  I've seen many examples online but none of them seems to fit my specific requirements.

 

I think I need multiple "if" conditions that will redirect any non-"https://www" queries to the "https://www" version of itself.

 

Below is the 301 redirection options I need to include in the .htaccess file:

 

 Routing-Table.thumb.png.d04f63ab7358df43c6012f2427c04c10.png

 

From the above table, you'll notice that I need at least 3 condition checks within my single .htaccess file. Also, as I'm using the same .htaccess file in my localhost as well as on my public web site, the "if" conditions will also need to accommodate localhost as well.

 

I can only test for either A, B or C from the list above.  I can't test a combination of all of them.

 

Please can a kind Neowin expert assist me?

 

Thank you.

 

 

9 answers to this question

Recommended Posts

  • 0

Why would the standard redirect all to https not work?

 


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

 

Why would you be using local host and not just use fqdn www.test.com that resolve to your local IP your site is listening on?  Be simple host file on your local machine for that matter.

 

You should be able to replace the variables with the exact fqdn you want to use https://www.test.com

  • 0

There is a actual "table", in my post (click here to see it), it illustrates the place the user start at and where I want them to end at (a "route").

 

So if a user tries "test.com",  they end up at "https://www.test.com",

If a user tries "www.test.com",  they end up at "https://www.test.com",

If a user tries "https://test.com",  they end up at "https://www.test.com",

If a user tries "255.255.255.255",  they end up at "https://www.test.com",

And also,

If a user tries "localhost",  they end up at "https://localhost".

If a user tries "brianpc",  they end up at "https://brianpc".

If a user tries "192.186.0.100",  they end up at "https://brianpc".

 

Original question was too confusing.  I hope you can help.

Thank you.

  • 0

Thanks Bud but you didn't exact answer the question. Redirecting https to https is easy but my questions was not to redirect http > https; it was to redirect multiple states of the URL to https://www.  So the actual question remains unanswered.  If it helps you, read this message, and see if you actually answered my question or not.

  • 0
45 minutes ago, Brian Miller said:

it was to redirect multiple states of the URL to https://www.

Dude yes the information redirects whatever they send to that via https, you can just edit it to go www.something.com

 

This is not all that difficult...  Here.. Lets go through it line by line

 

A,B and C - YES

D - Again yes..

EFG - Yes once again... But Freaking why??  Are you too freaking lazy to just go to https://www.domain.tld

 

And have that resolve to whatever your localhost box IP is? via simple entry in your host file on your host or via your dns you run on your network.  But to be honest your running Apache you should just do it via a redirect in your conf

 

http://httpd.apache.org/docs/current/rewrite/avoid.html#redirect

<VirtualHost *:80>
    ServerName www.example.com
    Redirect / https://www.example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName www.example.com
    # ... SSL configuration goes here
</VirtualHost>

 

Also if you want your using to use https you should really be setting up HSTS..

This topic is now closed to further replies.
  • Posts

    • Microsoft finally admits its default Windows 11 25H2, 24H2 action broke key legacy component by Sayan Sen Microsoft last week released Windows 11 KB5094126 and KB5093998 as the latest Patch Tuesday updates. Following that the company also published the accompanying dynamic updates under KB5094149, KB5095971, and KB5094156. So far the company has acknowledged two known issues that have popped up after the release which include bugged-out Office apps as well as the Recycle Bin; though there could be more at play too. Speaking of bugs and issues, Microsoft seems to have finally acknowledged a problem that probably has been around for close to a year. That's because back in July of 2025 the company made a default change to the latest Windows 11 versions, wherein it switched to JScript9Legacy on Windows 11 24H2 and later releases. Hence following the release of version 25H2 in October 2025, JScript9Legacy also remained default-enabled. As a result there has been a compatibility issue ever since then. For those wondering, by switching to JScript9Legacy Microsoft intended to improve the security of modern Windows PCs by reducing vulnerabilities tied to legacy scripting like cross-site scripting (XSS), among others. XSS exploits can allow cyber-attackers to attach malicious code onto legitimate websites and use them to execute the code when a potential victim loads such a website. Hence the new JScript9Legacy engine enforced stricter execution policies and improved object handling, which should help mitigate such attacks. Microsoft today has published a new support article detailing the problem. Neowin spotted it while browsing. The company says that JScript global definitions and execution context may fail to persist across scripts, potentially breaking older dependent apps and web-based components that relied on this legacy behavior. In the article Microsoft has confirmed that the issue stems from its move away from the older jscript9.dll engine in favor of jscript9legacy.dll. As mentioned above, while the newer engine was designed to address vulnerabilities and strengthen security it also changes how JScript handles execution context. As a result functions and definitions loaded by one script could no longer remain available to subsequent scripts once execution ended. The company notes that some applications worked correctly on earlier Windows versions because the older JScript engine automatically retained global definitions and execution state between scripts. Under the newer model though that behavior is disabled by default causing certain legacy workloads and polyfill-dependent scripts to fail. Microsoft says it addressed the problem via the KB5077241 update though the fix had not been enabled automatically in the following updates. As such admins must explicitly turn on persistent JScript execution context using a Registry setting that the tech giant shared today. The configuration can be applied to individual processes or system-wide through the FEATURE_ENABLE_PERSISTENCE registry key. The steps have been outlined below: Run the following command to create the feature control registry key: reg add "HKLM\Software\Policies\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_ENABLE_PERSISTENCE" Under this key, create a new DWORD (32-bit) value. Configure the value as follows: To enable persistence for specific processes only: Set the value to 1 for each target process name. To enable persistence for all processes: Add * as the key name and set its value to 1. You can find the official support article here on Microsoft's website.
    • The possibility that milk gathers back into a glass implies that gravity can be 'reversed'.
    • VidCoder 12.20 by Razvan Serea  VidCoder is a DVD/Blu-ray ripping and video transcoding application for Windows. It uses HandBrake as its encoding engine. Calling directly into the HandBrake library gives it a more rich UI than the official HandBrake Windows GUI. VidCoder can rip DVDs but does not defeat the CSS encryption found in most commercial DVDs. You’ll need the NET 8 Desktop Runtime. If you don’t have it, VidCoder will prompt you to download and install it. The Portable version is self-contained and does not require any .NET Runtime to be installed. You do not need to install HandBrake for VidCoder to work. Feature list: Multi-threaded MP4, MKV containers Completely integrated encoding pipeline: everything is in one process and no huge intermediate temporary files H.264, H.265, MPEG-4, MPEG-2, VP8, Theora video Hardware-accelerated encoding with AMD VCE, Nvidia NVENC and Intel QuickSync AAC, MP3, Vorbis, AC3, FLAC audio encoding and AAC/AC3/MP3/DTS/DTS-HD passthrough Target bitrate, size or quality for video 2-pass encoding Decomb, detelecine, deinterlace, rotate, reflect, chroma smooth, colorspace filters Powerful batch encoding with simultaneous encodes Customizable Pickers to automatically pick audio and subtitle tracks, destination, titles and more Instant source previews Creates small encoded preview clips Pause, resume encoding VidCoder 12.20 changes: Updated HandBrake core to 1.11.2. Download: VidCoder 12.20 | 47.0 MB (Open Source) Download: Portable VidCoder 12.19 | 89.3 MB Link: VidCoder Home Page | Github | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Too soon, I'm still not over this death!
  • Recent Achievements

    • Week One Done
      Jordan Smith earned a badge
      Week One Done
    • Reacting Well
      BizSAR earned a badge
      Reacting Well
    • First Post
      AndreaB earned a badge
      First Post
    • Week One Done
      Huge Trailer earned a badge
      Week One Done
    • Week One Done
      Classifyskilleducation earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      593
    2. 2
      +Edouard
      185
    3. 3
      PsYcHoKiLLa
      77
    4. 4
      Michael Scrip
      73
    5. 5
      Steven P.
      66
  • Tell a friend

    Love Neowin? Tell a friend!