skip to Main Content

I’v just activated an SSL Certificate on a site and went to add the usual .htaccess redirect info.

However, there’s an existing .htaccess file with a whole set of redirects already in place (I’ll attach at the bottom).

When I try to add the https re-direct it keeps trying to redirect and eventually gives up…
Is there a way to keep add the https redirect in?

Here’s the existing .htaccess file contents:

#php_value auto_prepend_file    /kunden/homepages/8/d130052251/htdocs/kralinator/hosted/bellemellor/admin/psycho.php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -Indexes
RewriteEngine On
RewriteBase /

#Rewrites...
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule .* - [L]

RewriteCond %{QUERY_STRING} ^[^=]*$
RewriteCond %{QUERY_STRING} %2d|- [NC]
RewriteRule .? - [F,L]

#JS/CSS combinator
RewriteRule ^admin/css/(.*.css) admin/combine.php?type=css&files=$1
RewriteRule ^admin/js/(.*.js) admin/combine.php?type=javascript&files=$1
#RewriteRule ^css/(.*.css) combine.php?type=css&files=$1
#RewriteRule ^js/(.*.js) combine.php?type=javascript&files=$1

#Pages
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?level1=$1 [N,QSA]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?level1=$1&level2=$2 [N,QSA]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?    level1=$1&level2=$2&level3=$3 [N,QSA]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?level1=$1&level2=$2&level3=$3&level4=$4 [N,QSA]
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?level1=$1&level2=$2&level3=$3&level4=$4&level5=$5 [L,QSA]

I added the https redirect in different locations in the file but to no avail.
I’m a front-end developer and haven’t encountered this before as I normally only have the basic https redirect in a .htaccess file as follows:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.co.uk/index.php$1 [R,L]

Thanks in advance.

2

Answers


  1. Chosen as BEST ANSWER

    Solved it. There was a config file that was being loaded which was set to https false which jut sent everything back and forth… Changed that and all good.


  2. You can try something like this. It will redirect any URL on port 80 to the https version. Then your other htaccess rewrites should still work too.

    This will need to be placed at the top below RewriteBase /

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search