<h3>For Documentation out of the comments:</h3>
<p><code>'loginPath' =&gt; '/'</code> was present in <code>config/general.php</code>, after removal of this line the website started working again.</p>
<h2>Conclusion:</h2>
<p><strong>Don't set the Admin Backend or any other type of URL which requires a login</strong> (or is special in any way really) <strong>to <code>&quot;/&quot;</code> or an empty string</strong>, this can and will very likely cause <strong>major issues</strong> such as a completely <strong>non-functioning site unless index.php is in the URL</strong> (at all times).</p>
<h3>Sidenote</h3>
<p>I once faced a similar issue, the <code>cpTrigger</code> in <code>config/general.php</code> to an inexistant .env variable, eg <code>$cpTr1gger</code>, but since that wasn't present in my <code>.env</code> and I used <code>getenv('cpTrigger')</code> which <strong>returns empty strings if the requested var isn't found</strong>, it completely broke my website, similar to the above mentioned issue, it only worked with <code>index.php</code> in the URL.</p>

CC BY-SA 4.0
2019-12-09T13:46:57.847Z
2019-12-09T13:46:57.847Z
2020-06-17T08:56:27.903Z
Campiotti
<p>For some reason I can no longer go to my default site URL while I am logged in.</p>

<p>Going to <code>http://localhost:3001/craft-site/web/</code> gives me the following message in Chrome:</p>

<blockquote>
  <p>ERR_TOO_MANY_REDIRECTS</p>
</blockquote>

<p>Trying to refresh the site gives me this strange error message from Craft:</p>

<blockquote>
  <p>HTTP 404 – Not Found – yii\web\NotFoundHttpException</p>
  
  <p>Template not found: $DEFAULT_SITE_URL/$DEFAULT_SITE_URL</p>
</blockquote>

<p>I can still go to <code>http://localhost:3001/craft-site/web/index</code> while logged in and it works fine. The most interesting thing is that the file <code>index.twig</code> is completely empty.</p>

CC BY-SA 4.0
2019-12-09T13:13:57.960Z
What is the value that you've set in your `.env` for `DEFAULT_SITE_URL`?
Campiotti
CC BY-SA 4.0
2019-12-09T13:15:48.713Z
.env says ```DEFAULT_SITE_URL="http://localhost:3001/craft-site/web"```
PWL
CC BY-SA 4.0
2019-12-09T13:22:02.140Z
1. What are you using to run your local server (Apache, Nginx, PHP, etc...)?
2. What happens when you try and access the Control Panel (`config/general.php's cpTrigger value`) in your browser: A. with `index` in your URL. B. without `index` in your URL?

I'm thinking you might have some config stuff that's broken since the craft error is saying `Template not found: $DEFAULT_SITE_URL/$DEFAULT_SITE_URL` which makes sense as you wouldn't have the entire webserver address as a file/template on your system...
Campiotti
CC BY-SA 4.0
2019-12-09T13:26:29.183Z
Tried to undo my last steps and I found ```'loginPath' => '/'``` in my ```config\general.php```. I did that because the front page has the login. For some reason it was not a good idea to set that to the root URL. Removed this line and it is now working again.
PWL
CC BY-SA 4.0
2019-12-10T13:23:47.087Z
Oh by the way could you either write your own answer and mark it or mark my answer as "the answer"/"the solution" so this question doesn't remain marked as "unanswered" and instead be marked as "solved"? This will help others facing similar issues when they find your question as they'll be aware that there was a solution found with your issue. Thanks!
Campiotti
<craft3>
Cannot go to site URL while logged in without index in URL
# Cannot go to site URL while logged in without index in URL

(Asked by: username_0 on 2019-12-09)

For some reason I can no longer go to my default site URL while I am logged in.

Going to `http://localhost:3001/craft-site/web/` gives me the following message in Chrome:

> ERR\_TOO\_MANY\_REDIRECTS

Trying to refresh the site gives me this strange error message from Craft:

> HTTP 404 – Not Found – yii\web\NotFoundHttpException
>
> Template not found: $DEFAULT\_SITE\_URL/$DEFAULT\_SITE\_URL

I can still go to `http://localhost:3001/craft-site/web/index` while logged in and it works fine. The most interesting thing is that the file `index.twig` is completely empty.

**Tags:** craft3
> **Comments:**
> **username_1**: What is the value that you've set in your `.env` for `DEFAULT_SITE_URL`?  
> **username_0**: .env says ```DEFAULT_SITE_URL="http://localhost:3001/craft-site/web"```  
> **username_1**: 1. What are you using to run your local server (Apache, Nginx, PHP, etc...)? 2. What happens when you try and access the Control Panel (`config/general.php's cpTrigger value`) in your browser: A. with `index` in your URL. B. without `index` in your URL?  I'm thinking you might have some config stuff that's broken since the craft error is saying `Template not found: $DEFAULT_SITE_URL/$DEFAULT_SITE_URL` which makes sense as you wouldn't have the entire webserver address as a file/template on your system...  
> **username_0**: Tried to undo my last steps and I found ```'loginPath' => '/'``` in my ```config\general.php```. I did that because the front page has the login. For some reason it was not a good idea to set that to the root URL. Removed this line and it is now working again.  
> **username_1**: Oh by the way could you either write your own answer and mark it or mark my answer as "the answer"/"the solution" so this question doesn't remain marked as "unanswered" and instead be marked as "solved"? This will help others facing similar issues when they find your question as they'll be aware that there was a solution found with your issue. Thanks!  

---

## 1 answers

### Answer by username_1 on 2019-12-09. Score: 2 | Accepted answer

### For Documentation out of the comments:

`'loginPath' => '/'` was present in `config/general.php`, after removal of this line the website started working again.

## Conclusion:

**Don't set the Admin Backend or any other type of URL which requires a login** (or is special in any way really) **to `"/"` or an empty string**, this can and will very likely cause **major issues** such as a completely **non-functioning site unless index.php is in the URL** (at all times).

### Sidenote

I once faced a similar issue, the `cpTrigger` in `config/general.php` to an inexistant .env variable, eg `$cpTr1gger`, but since that wasn't present in my `.env` and I used `getenv('cpTrigger')` which **returns empty strings if the requested var isn't found**, it completely broke my website, similar to the above mentioned issue, it only worked with `index.php` in the URL.


---

