# Panel login failure when changin the .htaccess-file to redirect non-www to www

**URL:** <https://forum.getkirby.com/t/panel-login-failure-when-changin-the-htaccess-file-to-redirect-non-www-to-www/11149>\
**Category:** Questions\
**Tags:** v2\
**Created:** [September 3, 2018, 9:43am UTC](https://forum.getkirby.com/t/panel-login-failure-when-changin-the-htaccess-file-to-redirect-non-www-to-www/11149 "2018-09-03T09:43:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![teh](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teh/32/9669_2.png) [@teh](https://forum.getkirby.com/u/teh)\
**Post date:** [September 3, 2018, 9:43am UTC](https://forum.getkirby.com/t/panel-login-failure-when-changin-the-htaccess-file-to-redirect-non-www-to-www/11149/1 "2018-09-03T09:43:28Z")

</div>

Hi!

Unfortunately, since I changed the .htaccess-file to redirect all non-www to www, the panel won’t let me log in anymore but just redirects to the panel without any error-message.

My .htaccess-content is:

```
RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]

RewriteRule ^assets/plugins/([a-zA-Z0-9\.\-_%=]+)/(.*)$ site/plugins/$1/assets/$2 [L,N]
RewriteCond $1 !^plugins/[a-zA-Z0-9\.\-_%=]+/assets/.*
RewriteRule ^site/(.*) index.php [L]

RewriteRule ^(kirby|panel\/app|panel\/tests)/(.*) index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

```

Sorry if this is a very basic question, but I’m not very good in writing .htaccess-content.

Thanks for your wisdom!

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 3, 2018, 11:01am UTC](https://forum.getkirby.com/t/panel-login-failure-when-changin-the-htaccess-file-to-redirect-non-www-to-www/11149/2 "2018-09-03T11:01:32Z")

</div>

Try this instead:

```auto
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

```

Is that on shared hosting or your own server with access to the server configuration?

---

<div class="post-metadata">

**Author:** ![teh](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/teh/32/9669_2.png) [@teh](https://forum.getkirby.com/u/teh)\
**Post date:** [September 3, 2018, 3:27pm UTC](https://forum.getkirby.com/t/panel-login-failure-when-changin-the-htaccess-file-to-redirect-non-www-to-www/11149/3 "2018-09-03T15:27:14Z")

</div>

Thanks, that worked!  
www redirects to non-www now though, but I’ll just leave it like that.

(It’s shared hosting.)

Thanks!

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:26pm UTC](https://forum.getkirby.com/t/panel-login-failure-when-changin-the-htaccess-file-to-redirect-non-www-to-www/11149/4 "2025-02-06T17:26:18Z")

</div>

Archived on February 6, 2025, 5:26pm UTC


