The Apache HTTP daemon supports name-based hosting so that multiple domain names can share one IP address. Changing a host name effectively changes your website's domain name, since your visitors request the site by sending its host name, in the form of a URL, to your specified port in the request's HTTP headers. The Apache web server is easy to install. With one command, you can install it and all necessary dependencies: $ dnf install httpd All the configuration files for Apache are located in /etc/httpd/conf and /etc/httpd/conf.d. The Apache HTTP Server, colloquially called Apache, is a Web server application notable for playing a key role in the initial growth of the World Wide Web. Originally based on the NCSA HTTPd server, development of Apache began in early 1995 after work on the NCSA code stalled.
Webmasters and students may want to learn how to redirect an old domain to a new one or one sub-domain to another or HTTP to HTTPS… For example, with Apache2 redirect modules, one can redirect http//example.net to http://example.com or http://www.example.com to http://example.com or http://example.com to https://example.com…
Apache Http Server Vs Tomcat
This brief tutorial is going to show students and new users how to set up Apache2 directs easily… the method below can also be used with switching your HTTP domain to HTTPS…
When you’re ready to configure Apache2 directs, continue below:
Step 1: Install / Configure Apache2 HTTPS
To configure Apache2 to redirect all traffic to HTTPS, you must configure and enable its SSL modules.. The post below shows you how to install and configure Apache2 to communicate over HTTPS… however, both HTTP and HTTPS are enabled… the method below will show you how to redirect all traffic to the server to use HTTPS only..
Step 2: Redirect Apache2 HTTP to HTTPS
Our post above set up Apache2 to communicate over both HTTP and HTTPS… however, in today’s environment, it’s recommended to choose one type of protocol and redirect the other to it..
For example, you should redirect all HTTP (80) to HTTPS (443). To do that, add the highlighted portion of the code to your Apache2 site configuration file…
Run the commands below to open Apache2 default site configuration file..
sudo nano /etc/apache2/sites-available/000-default.conf
Then add the highlighted portion to the bottom of the file.
Redirect to same domain on HTTPS only
The configuration above redirect all requests to use HTTPS only to communicate with the server with domain name example.com. So, http://example.com and http://www.example.com will be redirect to https://example.com
Step 3: Redirect Old Domain to New
If you want to redirect from an old domain to a new one, the setting below should help you do that… For this setup, HTTPS isn’t required… Run the commands below to open Apache2 default site configuration file.
sudo nano /etc/apache2/sites-available/000-default.conf
Then add the highlighted portion to the bottom of the file.
Redirect old domain to new domain
The above code added to your Apache2 site configuration file will redirect an old domain to a new one without HTTPS…. the highlighted code above redirects http://example.net and http://www.example.net to http://example.com
After making the changes above, run the commands below to test your settings and enable Apache2 rewrite and SSL modules.
Apache Http Server
If you don’t see any error messages then you’re good. Restart Apache2 web server by running the commands below.
sudo systemctl restart apache2.service
Apache Http Server Pdf
That’s it! This is how to configure Apache2 HTTP 301 redirects
~Enjoy~
Apache Http Server Port
You may also like the post below: