Please help with my .HTACCESS (trailing slash)

Posted in: Newspaper
Post count: 20

Hello everyone,

i need help with my .HTACCESS file.

What i want:

  • Force HTTPS (does it already i think)
  • Force Trailing Slash / at the end of URL
  • Force WWWW to NOT show

This is what my Code looks like now, i didn’t change anything yet.


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

# BEGIN WordPress
# Die Anweisungen (Zeilen) zwischen „BEGIN WordPress“ und „END WordPress“ sind
# dynamisch generiert und sollten nur über WordPress-Filter geändert werden.
# Alle Änderungen an den Anweisungen zwischen diesen Markierungen werden überschrieben.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Edit: Site is https://top-wp.de/

Thank you!

Post count: 27744

Hello,

Please check this guide: https://www.danielmorell.com/guides/htaccess-seo/redirects/https-www-and-trailing-slash. Also, you can ask your host to help to achieve this because this request is related more to the host, and he knows exactly how to do it.

Thank you!

Post count: 47

@Anamaria was faster..

Hey Kollege 😉
Das hat aber nichts mit Theme Support zu tun. Das ist ja WordPress “Coding” Allgemein.

Aber egal:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-domain\.com$ [NC]
RewriteRule ^(.*)$ http://my-domain.com/$1 [R=301,L]

Das müsste der Aufruf sein und damit wird das www. vorher “abgeschnitten”.

  • This reply was modified 2 years by Tribun74.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.