# Too Many Redirects

**URL:** <https://community.modx.com/t/too-many-redirects/7222>\
**Category:** Support\
**Created:** [November 15, 2023, 10:18am UTC](https://community.modx.com/t/too-many-redirects/7222 "2023-11-15T10:18:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisandy](https://community.modx.com/user_avatar/community.modx.com/chrisandy/32/340_2.png) [@chrisandy](https://community.modx.com/u/chrisandy)\
**Post date:** [November 15, 2023, 10:18am UTC](https://community.modx.com/t/too-many-redirects/7222/1 "2023-11-15T10:18:48Z")

</div>

Trying to force https i.e. htttp://wwwdotmysitedotcodotuk should go to htttps://wwwdotmysitedotcodotuk.

I’ve just moved this site from a dev server to the client’s existing hosting package (which I’m stuck with) and the usual settings in my htaccess file in public\_html results in an error ‘too many redirects’. On top of this when I comment out the parts of the htaccess file that cause a problem it takes around 10 refreshes to get the site up and running again which suggests there is some sort of caching in play.

Currently only the friendly URLs part is not commented out in my htaccess file…

```auto
# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

```

Even the next part breaks the site if uncommented…

```auto
###RewriteEngine On
###RewriteBase /

```

There is a htaccess file above public\_html that contains…

```auto
#+PHPVersion
#="php81"
AddHandler x-httpd-php81 .php
#-PHPVersion

#+Unmarked
#EOF
#-Unmarked

#EOF

```

…is this likely to be interfering with my htaccess file?

This is MODX 3.0.3. Apart from it being Linux hosting / Apache and PHP8.1 there’s not much more I can see about the hosting.

I’ll raise a support ticket but at the moment can anybody tell me where to start looking for clues?

---

<div class="post-metadata">

**Author:** ![dev\_willis](https://community.modx.com/user_avatar/community.modx.com/dev_willis/32/1721_2.png) [@dev\_willis](https://community.modx.com/u/dev_willis)\
**Post date:** [November 15, 2023, 12:31pm UTC](https://community.modx.com/t/too-many-redirects/7222/2 "2023-11-15T12:31:37Z")

</div>

Whenever I run into this problem it’s usually because my DNS and my host are competing. I use Cloudflare for DNS and I have to set the SSL/TLS setting to `Full` instead of the default `Flexible`.

---

<div class="post-metadata">

**Author:** ![chrisandy](https://community.modx.com/user_avatar/community.modx.com/chrisandy/32/340_2.png) [@chrisandy](https://community.modx.com/u/chrisandy)\
**Post date:** [November 15, 2023, 12:55pm UTC](https://community.modx.com/t/too-many-redirects/7222/3 "2023-11-15T12:55:12Z")

</div>

You are probably right. This is an external domain pointed to this hosting account and although I can see the dns I daren’t touch it as they have other services running but there do seem to be duplicated records.

---

<div class="post-metadata">

**Author:** ![bobray](https://community.modx.com/user_avatar/community.modx.com/bobray/32/46_2.png) [@bobray](https://community.modx.com/u/bobray)\
**Post date:** [November 15, 2023, 8:21pm UTC](https://community.modx.com/t/too-many-redirects/7222/4 "2023-11-15T20:21:45Z")

</div>

> [@chrisandy](#):
>
> ```auto
> ###RewriteEngine On
> ###RewriteBase /
> 
> ```

This should be above any rewrite rules or conditions.

---

<div class="post-metadata">

**Author:** ![chrisandy](https://community.modx.com/user_avatar/community.modx.com/chrisandy/32/340_2.png) [@chrisandy](https://community.modx.com/u/chrisandy)\
**Post date:** [November 16, 2023, 10:31am UTC](https://community.modx.com/t/too-many-redirects/7222/5 "2023-11-16T10:31:58Z")

</div>

It is Bob - threw it into the post last of all to illustrate that even if I uncommented that it caused a problem. It is at the top of the htaccess file.

---

<div class="post-metadata">

**Author:** ![chrisandy](https://community.modx.com/user_avatar/community.modx.com/chrisandy/32/340_2.png) [@chrisandy](https://community.modx.com/u/chrisandy)\
**Post date:** [November 16, 2023, 10:37am UTC](https://community.modx.com/t/too-many-redirects/7222/6 "2023-11-16T10:37:41Z")

</div>

One way or another this seems to be solved. I’ve got very limited access in the control panel - couldn’t even raise a support ticket without going through the IT company manages the hosting on behalf of the client.

I was eventually sent a link to ‘Force HTTPS’ - there’s nowhere in the control panel that was accessible. Once it was switched on, my htaccess file works as expected. It’s a little annoying and worrying that I can’t open or edit the htaccess file from within the manager ‘You do not have permission to access this resource’. That suggests ownership issues or security settings that I don’t have access to.

What makes hosting like this more awkward is some sort of inbuilt caching which I seem unable to disable.

I could do with upgrading this site to 3.0.4 but nervous that something will catch me out.

---

<div class="post-metadata">

**Author:** ![bobray](https://community.modx.com/user_avatar/community.modx.com/bobray/32/46_2.png) [@bobray](https://community.modx.com/u/bobray)\
**Post date:** [November 16, 2023, 11:44pm UTC](https://community.modx.com/t/too-many-redirects/7222/7 "2023-11-16T23:44:41Z")

</div>

Do you have File Manager in cPanel? What about PhpMyAdmin?

If you have FM, can you edit .htaccess that way?

If not, that’s a pretty severe handicap (not to mention the host’s willingness to rewrite your .htaccess file, which would make me nervous).

---

<div class="post-metadata">

**Author:** ![chrisandy](https://community.modx.com/user_avatar/community.modx.com/chrisandy/32/340_2.png) [@chrisandy](https://community.modx.com/u/chrisandy)\
**Post date:** [November 17, 2023, 12:02pm UTC](https://community.modx.com/t/too-many-redirects/7222/8 "2023-11-17T12:02:07Z")

</div>

Yeah I can edit the htaccess in FM - no problem, except that until I was able to switch on Force HTTPS anything I did in htaccess was breaking the site.

---

<div class="post-metadata">

**Author:** ![bobray](https://community.modx.com/user_avatar/community.modx.com/bobray/32/46_2.png) [@bobray](https://community.modx.com/u/bobray)\
**Post date:** [November 19, 2023, 10:44pm UTC](https://community.modx.com/t/too-many-redirects/7222/9 "2023-11-19T22:44:15Z")

</div>

I wonder if that implies an `.htaccess` file higher up the tree that’s only visible to the ISP.

---

<div class="post-metadata">

**Author:** ![chrisandy](https://community.modx.com/user_avatar/community.modx.com/chrisandy/32/340_2.png) [@chrisandy](https://community.modx.com/u/chrisandy)\
**Post date:** [November 20, 2023, 5:25pm UTC](https://community.modx.com/t/too-many-redirects/7222/10 "2023-11-20T17:25:15Z")

</div>

I think you are probably right Bob
