# RewriteRule anlegen

**URL:** <https://forum.shopware.com/t/rewriterule-anlegen/72015>\
**Category:** Allgemein\
**Created:** [11. Januar 2021 um 14:35 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015 "2021-01-11T14:35:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kischd](https://avatars.discourse-cdn.com/v4/letter/k/c77e96/32.png) [@kischd](https://forum.shopware.com/u/kischd)\
**Post date:** [11. Januar 2021 um 14:35 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/1 "2021-01-11T14:35:17Z")

</div>

Hallo zusammen,

ich versuche gerade herauszufinden wo ich die rewriteRule anlegen kann, bzw, dass diese auch zieht.

Ich habe im public Ordner in der Htaccess die Zeilen eingefügt:

RewriteCond %{HTTP\_HOST} ^[website.de](http://website.de) [NC]  
RewriteRule (.\*) [https://www.website.de/$1](https://www.website.de/%241) [R=301,L]

RewriteCond %{HTTPS} !=on  
RewriteRule ^ https://%{HTTP\_HOST}%{REQUEST\_URI} [L,R=301]

&nbsp;

Wenn ich nun den Browsercache leere und die Domain eingebe:&nbsp;&nbsp; [domain.de](http://domain.de)  
also ohne www und https folgt als Ergebnis ein Fehler 500

---

<div class="post-metadata">

**Author:** ![frezno](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/frezno/32/7801_2.png) [@frezno](https://forum.shopware.com/u/frezno)\
**Post date:** [11. Januar 2021 um 14:49 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/2 "2021-01-11T14:49:19Z")

</div>

die htaccess im public Ordner wäre schon der richtige Platz dafür.  
Was genau möchtest du denn machen?

---

<div class="post-metadata">

**Author:** ![kischd](https://avatars.discourse-cdn.com/v4/letter/k/c77e96/32.png) [@kischd](https://forum.shopware.com/u/kischd)\
**Post date:** [11. Januar 2021 um 16:02 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/3 "2021-01-11T16:02:04Z")

</div>

hallo @frezno‍

wenn ich [domain.de](http://domain.de) (als beispiel) eingebe, soll im Browser auf https:\[www.domain.de](http://www.domain.de) umgeschrieben werden.

Beim mir kommt jedoch Fehler 500 ![Crying](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/3d74433e0d4d6cb84e92906c2faceb6b50db91bf.png "Crying")

---

<div class="post-metadata">

**Author:** ![frezno](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/frezno/32/7801_2.png) [@frezno](https://forum.shopware.com/u/frezno)\
**Post date:** [11. Januar 2021 um 16:10 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/4 "2021-01-11T16:10:04Z")

</div>

RewriteEngine On

RewriteCond %{HTTP\_HOST} !^www.domain.de$ [NC]  
RewriteRule ^(.\*)$ [https://www.domain.de/$1](https://www.domain.de/%241) [L,R=301]

RewriteCond %{SERVER\_PORT} !=443  
RewriteRule ^(.\*)$ [https://www.domain.de/$1](https://www.domain.de/%241) [R=301,L]

---

<div class="post-metadata">

**Author:** ![kischd](https://avatars.discourse-cdn.com/v4/letter/k/c77e96/32.png) [@kischd](https://forum.shopware.com/u/kischd)\
**Post date:** [11. Januar 2021 um 17:07 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/5 "2021-01-11T17:07:02Z")

</div>

Ich poste mal den Ganzen Block:

```
    RewriteEngine On

    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Sets the HTTP_AUTHORIZATION header removed by Apache
    RewriteCond %{HTTP:Authorization} .
    RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule ^ %{ENV:BASE}/index.php [L]
	

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

RewriteCond %{SERVER_PORT} !=443
RewriteRule ^(.*)$ https://www.domain.de/$1 [R=301,L]

```

es kommt immer noch die 500. ![Crying](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/crying.png "Crying")

---

<div class="post-metadata">

**Author:** ![frezno](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/frezno/32/7801_2.png) [@frezno](https://forum.shopware.com/u/frezno)\
**Post date:** [11. Januar 2021 um 17:39 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/6 "2021-01-11T17:39:19Z")

</div>

in den SHopware Block darfst du nicht reinschreiben, da der dyn. angelegt wird.

Schreib es mal als erstes, also vor dem

# BEGIN Shopware

---

<div class="post-metadata">

**Author:** ![kischd](https://avatars.discourse-cdn.com/v4/letter/k/c77e96/32.png) [@kischd](https://forum.shopware.com/u/kischd)\
**Post date:** [11. Januar 2021 um 18:00 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/7 "2021-01-11T18:00:17Z")

</div>

Niiiiicccccccccccccceeeeeee

&nbsp;

So funktioniert es. also am Besten alles über # BEGIN Shopware ![Thumb-Up](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/7fcda44f782696668a3d093569d15e88105769e1.png "Thumb-Up")

---

<div class="post-metadata">

**Author:** ![frezno](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/frezno/32/7801_2.png) [@frezno](https://forum.shopware.com/u/frezno)\
**Post date:** [11. Januar 2021 um 19:16 UTC](https://forum.shopware.com/t/rewriterule-anlegen/72015/8 "2021-01-11T19:16:58Z")

</div>

![Thumb-Up](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/thumb-up.png "Thumb-Up")
