• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Https to http redirection using htaccess


I have recently removed ssl and would like to keep my website to http but I am unable to get my hands on a code that I must add to redirect my https urls to http.

I would appreciate if you could provide me with the code that I need to add in my htaccess file and where in that file.

What I find every where is http to https but I want the opposite.

Jake Bunce

XenForo moderator
Staff member
Add the red code to your .htaccess file to force no ssl:

#	Mod_security can interfere with uploading of content such as attachments. If you
#	cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#	SecFilterEngine Off
#	SecFilterScanPOST Off

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
	RewriteEngine On

	RewriteCond %{SERVER_PORT} 443
	RewriteRule ^(.*)$ http://yoursite.com/$1 [R,L]

	#	If you are having problems with the rewrite rules, remove the "#" from the
	#	line that begins "RewriteBase" below. You will also have to change the path
	#	of the rewrite to reflect the path to your XenForo installation.
	#RewriteBase /xenforo

	#	This line may be needed to enable WebDAV editing with PHP as a CGI.
	#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -l [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^.*$ - [NC,L]
	RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
	RewriteRule ^.*$ index.php [NC,L]

Tracy Perry

Well-known member
Removing SSL = epic fail.
Not if you need certain features. I'm currently trying some stuff with HTML5 and calls to JS that depend upon API's from a couple of other sites... and guess what. They don't DO SSL. So, now you have a major problem as you can't use the content.
OK, sorry to bring this thread back, but I have an issue with redirect. All was setup and no matter what URL someone would type, as long as it had the website address, it would land on a redirection page with a short blurb.

After a server reboot, it's not doing this anymore. Looking at my htaccess file now, I don't know what to do with this. Or should I basically just do a redirect from the CPanel?

This is what I have right now.

RewriteEngine on

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"

<Files 403.shtml>
order allow,deny
allow from all

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

RewriteCond %{HTTP_HOST} ^vi\-control\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.vi\-control\.net$
RewriteRule ^portal\/?$ "http\:\/\/vi\-control\.net\/community" [R=301,L]

RewriteCond %{HTTP_HOST} ^vi\-control\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.vi\-control\.net$
RewriteRule ^/?$ "http\:\/\/vi\-control\.net\/portal" [R=301,L]
Thanks for any help,

Hi Jake,

Yes, I figured finally... :)

I added this line of code to my root htaccess file:
ErrorDocument 404 http://www.vi-control.net/404.shtml
And now it doesn't matter what URL is entered, as long as there is http://www.vi-control.net/ as a prefix, it will end up on my custom 404.shtml page.

So all good!