Use Htaccess-File To Redirect All Requests Possible: Http To Https etc


Recommended Posts

hi there - good day dear experts 


This is the .htaccess code for permalinks in WordPress.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

we have the following ingrediences: 

-f and -d part means to give real directories and files higher priority.


how it works: 

^index\.php$ - [L] prevents requests for index.php from being rewritten, 

to avoid an unnecessary file system check. If the request is for index.php the directive does nothing

 - and stops processing rules [L].

This following block is all one single rule: this rule says that if it is not a real file and not a real directory, reroute the request to index.php.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

well - the index.php itself interprets the URL that was requested by the client-machine (since PHP can see the requested URL using $_SERVER['REQUEST_URI']) and it calls the correct code for rendering the page the user requested.


and now to the issue of today:  i want to do this for using to redirect HTTP to HTTPs with mydomain - what kind of htaccess do i need to run?

what is wanted:  i want to do this for using to redirect HTTP to HTTPs with https://www.mydomain.com and https://mydomain.com/ and http://mydomain.com - what kind of htaccess do i need to run 


With my current .htaccess, this is what happens:

 

https://www.mydomain.com/ - i need this 

https://mydomain.com/ -i need this that subsequently  redirects to the above which would be  great

, it should redirect to the https version: 

note: i all way thought that i need to have a new /(and extra vhost to do this)

http://www.mydomain.com/

http://mydomain.com/


Here is the .htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
	# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
	


again: what is wanted: i want to have a redirect that helps in each time & situation With my current .htaccess, 

 

https://www.mydomain.com/ - i need this 
https://mydomain.com/ -i need this that subsequently  redirects to the above which would be  great

what is aimed: all options should load fine, it should redirect to the https version:  
note: i allways thought that i need to have a new /(and extra vhost to do this). but perhaps i do not need a second vhost!? Perhaps i can do it with .htaccess too!?

http://www.mydomain.com/
http://mydomain.com/


can you help out here..!?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Chinese? It sounds extremely dangerous. I’ll reconsider buying a Meta Quest 3.
    • - What's your salary? Is it more than $100k a year? - Nah, it's $100 mil a year.
    • Compared to my ear buds which are the size of a matchbox, cover a much broader frequency range, and work everywhere without setup? Yeah, still not buying this as a replacement.
    • Meta's Superintelligence team staffed by 50% Chinese talent, 40% ex-OpenAI by Hamid Ganji Mark Zuckerberg's latest big bet at Meta involves building a team of the best AI superstars in the market to lead the so-called Superintelligence Labs. The goal of this team is to develop AI models that will ultimately lead to Artificial General Intelligence (AGI). AGI refers to an AI model with capabilities comparable to, or even beyond, those of the human brain. Achieving human-level cognitive abilities with an AI model requires substantial investments, as well as hiring the best talent to build such a system. That's why Meta is throwing hundreds of millions of dollars at AI researchers from OpenAI, Apple, and other companies to recruit them for its Superintelligence team. A user on X has now shared a spreadsheet that provides us with some unique insights into Meta's Superintelligence team and the origins of its 44 employees. The leaker claims this information comes from an anonymous Meta employee. The listing claims that 50 percent of the staff at the Superintelligence team are from China, which demonstrates the significant role of Chinese or Chinese-origin researchers in Met's AI efforts. Additionally, 75 percent of these staff hold PhDs, and 70 percent of them work as researchers. Interestingly, 40 percent of the staff are ex-OpenAI employees whom Mark Zuckerberg poached from the maker of ChatGPT. Additionally, 20 percent of Meta's Superintelligence team members come from Google DeepMind, and another 15 percent come from Scale AI, a startup that Meta recently acquired in a $15 billion deal. Another interesting point is that 75 percent of the Superintelligence team are first-generation immigrants. The leaker claims that each of these employees is now earning between $10 million and $100 million per year, although Meta still needs to confirm these substantial figures. However, it has already been reported that Meta is offering up to $100 million in signup bonuses to poach the best AI talent from OpenAI and other rivals. The revelation that half of Meta's Superintelligence team consists of Chinese nationals could trigger concerns within the Trump administration and Congress.
    • From a quick Google it seems 6GHz is optional on 802.11be. Ubiquiti has one, Unifi U7 Lite.
  • Recent Achievements

    • First Post
      nobody9 earned a badge
      First Post
    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
    • One Month Later
      Ian_ earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      ATLien_0
      207
    3. 3
      Michael Scrip
      206
    4. 4
      Xenon
      138
    5. 5
      +FloatingFatMan
      113
  • Tell a friend

    Love Neowin? Tell a friend!