www vs no www domain/pointer redirection (SKIN)(TEMPLATES)

Version 1.57.0


Relating to the previous feature here: https://directadmin.com/features.php?id=2234 where it's mentioned it will be changed, this is that change. Instead of just redirecting pointers, it will also apply to the main domain itself. Naming will change from: www_pointers to now be one of: force_redirect=www force_redirect=non-www force_redirect=none where both the domain.com/www.domain.com, and all pointers would be affected by it. The previous change only applied to pointers. The "force ssl" checkbox also plays into this setting. DISABLED BY DEFAULT Although it may seem that www_pointers=yes can convert to force_redirect=www, this would be false, as it affects domains too (not just pointers) In testing, some domains had redirects in their .htaccess file, causing loops. As a result, the auto-conversion has been disabled, so the old www_pointer feature is dropped, and the new feature is just off by default (not redirection happens) Users can go to: User Level -> Domain Setup -> domain.com -> Force Redirect to enable it. Pointers will also use this setting. The old feature allows setting &www=no to the domains/domain.com.pointers file, which will still be respected (overriding the domain's setting) === Use the current FORCE_SSL_REDIRECT tokens in the virtual_host2*.conf files: Force www: RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Force non-www: RewriteCond %{HTTP_HOST} ^www\. RewriteRule ^ http://|DOMAIN|%{REQUEST_URI} [L,R=301] none: follow the current "force ssl" rules. Note: the RewriteRule would go to https instead of http, but only for VH:80, because force_ssl option only applies to VH:80. The VH:443 doesn't need to force ssl.. since it's already ssl. ===== SKINS user/modify_domain.html replace the www_pointer with: <tr> <td class=list>www redirect</td> <td class=list align=left> <input type="radio" name="force_redirect" value='none' |FORCE_REDIRECT_NONE_CHECKED|> No redirection<br> <input type="radio" name="force_redirect" value='www' |FORCE_REDIRECT_WWW_CHECKED|> www.|DOMAIN|<br> <input type="radio" name="force_redirect" value='non-www' |FORCE_REDIRECT_NON_WWW_CHECKED|> |DOMAIN| </td> <td class=list>Redirection for domain, pointers,<br>and sub-domains.</td> </tr> ===== TEMPLATES virtual_host2_secure.conf virtual_host2_secure_sub.conf nginx_server_secure.conf nginx_server_secure_sub.conf added |FORCE_SSL_REDIRECT| token. Note that the 443 VirtualHosts will not fill the token with the force_ssl redirect, but will fill it with the www/non-www redirects. For 80 VirtualHosts, the FORCE_SSL_REDRECT token is filled with *both* redirections for force_ssl/www/non-www redirects. For any one given VirtualHost (eg: domain.com:80), there are 6 possible combinations using force_ssl, and the 3x force_redirect options. 12 if you include 80+443. pointers redirects and aliases, are 24 more, totaling 36 combinations. Subdomains, multiply that by 2 (subdomain or non-subdomain): 72 combinations. Apache, nginx, openlitespeed, nginx_proxy, multiplies that by 4, so we have a grand total of 288 combinations of test cases. We do have a test scripts, to show us all possible combinations, but it's unlikely all combinations will be actually tested (we'll do as much as is reasonable) Please try out this new feature and let us know if you run into any issues.

Interested to try DirectAdmin? Get a 30-day Free Trial!