Support

Admin Tools

#20125 303 redirect not 301 for https redirect

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 nicholas on Thursday, 22 May 2014 09:51 CDT

user79680
 Hello,

On ticket number #20104 you suggested I use SLL site wide. I also thought it was a good idea so I did it and got everything working.

Now a BIG PROBLEM is your htacess makes it using 303 redirects and not 301 redirects. You use a 301 to go from non www to www but not from http:// to https://.

It has to be a 301 or I can't do it.

Can you please tell me what I am doing wrong or what I need to fix.

Thanks

PS: Ticket number #20106 still has admin login info if you need it.

user79680
Hello,

I got this working.

I had to turn off your www to non www redirect and add the below to the top of the htaccess.

#First rewrite any request to the wrong domain to use the correct one (here www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


You can close this.

nicholas
Akeeba Staff
Manager
The R=301 is added when your server reports its version correctly and we detect that it's at least Apache 2.2 (2.0 and earlier did not support the R=301 qualifier in RewriteRule). If the server doesn't report its version number or reports a fake version number the .htaccess Maker will not add R=301, therefore a 302 or 303 redirect will be issued, depending on the Apache version.

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!

user79680
I am running Apache 2.2.25

Does not matter anyway right now it is working correctly.

I am pretty much htaccess illiterate. I found the answer by searching online.

Thanks again.

nicholas
Akeeba Staff
Manager
I don't think there is such a thing as ".htaccess literate" and I'm saying that being a developer and all. Apache configuration is a kind of black art that you learn by means of Google, tinkering, reading the help file, rinse and repeat. After all Apache got its name by its original monicker "A patchy [web] server" ;)

Regarding the Apache version, yes, I figured you're using Apache 2.2 or later, otherwise it would show a white screen of death as soon as you put that R=301 in the .htaccess file. The problem is that Apache doesn't report its real version to PHP. The end result is that PHP gets the web server version string "Apache" with no actual version number.

At this point I had a choice: assume it's Apache 2.2 and use R=301 and other similar goodies or assume the worst, Apache 2.0 or earlier, and refrain from using R=301. A year ago I chose to assume it's Apache 2.2 and use R=301. Guess what? We got flooded by support requests about .htaccess Maker causing people's sites to end up showing nothing but a blank page. Half a day later I reverted that decision and assume that a no-version Apache is Apache 2.0. Not a perfect solution, but putting the burden on you (our users) to select the correct version is an even worse solution. Most of our users don't even know if they have Apache, hence the "Will .htaccess Maker work on my server" text in the .htaccess Maker of Admin Tools 3.0.0. If you were me, between a rock, a hard place and a cliff which one would you choose? :)

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!

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!