Apache redirect domain.com to www.domain.com

https://‮ual.www‬tturi.com
Apache redirect domain.com to www.domain.com

To redirect requests for domain.com to www.domain.com on an Apache web server, you can use the Redirect directive in the Apache HTTPD configuration file or in a .htaccess file.

Here is an example of using the Redirect directive to redirect requests for domain.com to www.domain.com:

Redirect permanent / http://www.domain.com/

This directive will redirect all requests for domain.com to www.domain.com using the HTTP 301 permanent redirect status code.

Alternatively, you can use the RewriteRule directive in a .htaccess file to redirect requests for domain.com to www.domain.com, as shown below:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

This directive will redirect all requests for domain.com to www.domain.com using the HTTP 301 permanent redirect status code.

Keep in mind that the exact syntax and options for the Redirect and RewriteRule directives may vary depending on your specific Apache installation and configuration. It is always a good idea to refer to the official Apache documentation for detailed instructions and further information.

Created Time:2017-10-16 14:38:36  Author:lautturi