Support

Admin Tools

#26997 I cannot have a 301 www to non-www 301 redirect with the hatches Maker?

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by Chacapamac on Thursday, 02 February 2017 13:05 CST

Chacapamac
I’m trying to implement a nice clean redirect using hatches Maker but I cannot see it in the htaccess.

In the htaccess interface
• I put “Redirect www to non-www”
• I save without creating the hatches first (as I see in an other post)
• I after, “Save and Create’ with success message

The Created hatches redirection code become

##### Redirect www to non-www -- BEGIN
# HTTP
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R,L]
# HTTPS
RewriteCond %{HTTPS} =on [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} !=http
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R,L]
##### Redirect www to non-www -- END


No 301 Permanent ?

nicholas
Akeeba Staff
Manager
This depends on your Apache version and how it is reported by Apache itself. Custom redirection codes, i.e. the last bit in that line being
[R=301,L]
instead of
[R,L]
, were made available on Apache 2.2. If you are running an earlier version of Apache or if Apache reports the wrong (or no) version to PHP then Admin Tools "plays it safe" and only uses the old-style redirection you see. This is on purpose. Otherwise the .htaccess Maker was breaking all sites hosted on Apache 1.x and 2.0 server.

The Apache version is detected through the SERVER_SOFTWARE environment variable which is the recommended and, to the best of my knowledge, only way to do it universally through PHP. You can see its contents by going to your site's administrator backend and clicking on System, System Information. Go to the System Information tab (the first one) and look for the sixth line from bottom with the Setting reading "Web Server". The value to the right is the contents of the SERVER_SOFTWARE variable. Please note that if you are not using Apache itself but a "compatible" server such as Litespeed the custom redirection codes are not universally supported therefore Admin Tools' .htaccess Maker will NOT use them.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Chacapamac
I see, Thanks Nicholas, this is exactly what I did. The only sad part is that you cannot use the hatches maker after that customization. Do You ?

nicholas
Akeeba Staff
Manager
Unfortunately not :( I thought about letting you force the use of Apache 2.2+ syntax in the .htaccess Maker but I know where this will lead to: people insisting they have Apache 2.2 or later when they don't, enable this feature, get locked out of their site and us having a "fun" time trying to figure out what is going on...

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Chacapamac
I see, If you find a way to securely implement this, it will be a great addition the AdminTools.

Peace and Good Day!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!