Freundliche Internetadresse einrichten

UwePeterLudwig

Bekanntes Mitglied
Lizenzinhaber
Registriert
9. Aug. 2015
Beiträge
350
Punkte
68
XF Version
  1. 2.2.10 PL1
XF Instanz
Hosting
Hallo zusammen,

ich würde gerne eine freundliche Internetadresse einrichten.

Wenn diese Einstellung aktiviert ist, enthalten die vom System generierten Links keine Einträge mehr wie, zum Beispiel, "index.php?". Jedoch muss vor Aktivierung dieser Funktion dafür gesorgt werden, dass mod_rewrite auf dem Server verfügbar und eine entsprechend angepasste .htaccess-Datei im Verzeichnis vorhanden ist.

Also ersteres sollte verfügbar sein..

Auf den xy WebHosting-Servern ist das Apache-Modul mod_rewrite bereits standardmäßig aktiv. Damit Ihre Rewrite Rules greifen können, schalten Sie die sogenannte RewriteEngine ein.

Kann mir jemand sagen, was ich genau in der .htaccess anpassen muss? :confused:
Man findet dazu viele Versionen, aber bezüglich XenForo wollte ich hier doch noch einmal lieber nachfragen, da das sicherlich jemand eingerichtet hat. :)
 
Theoretisch solltest du nichts mehr anpassen müssen. Die "werksseitige" .htaccess von Xenforo reicht eigentlich aus.
 
nabend, dem xf-download sollte eine passende .htaccess datei beiliegen, die du benutzen kannst, anpassen musst du da i.d.r. nichts.

beim hochladen nur aufpassen, dass du keine evtl bereits vorhandene überschreibst.


[edit] @McAtze war ganz knapp schneller :D
 
Hm, ne geht nicht,

Error 500 oder so kommt gleich bei Aktivierung. :eek:

Erinnere mich aber auch nicht mehr ganz daran, woher die .htaccess kam. :rolleyes::confused:

Naja, ich schaue mal, ob ich die Datei von xen-Foro nehme und meine Änderungen übernehme.
 
Zuletzt bearbeitet:
Nicht viel, https: Umleitung, was von favicon und dann noch paar rewriterules, beginnt mit "Mod_security..."
 
Die .htaccess sollte so aussehen. Die individuellen Änderungen solltest du auch darin machen und keine eigene anlegen..
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Genau richtig. So schauts aus, mit meinen 2-3 Ergänzungen. Vielleicht liegts doch am Hoster. Ich muss da mal schauen.
 
Zeig doch mal deine, vielleicht ist ja auch nur ein Schreibfehler drin ..
 
Code:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
   RewriteEngine On

   #   If you are having problems with the rewrite rules, remove the "#" from the
   #   line that begins "RewriteBase" below. You will also have to change the path
   #   of the rewrite to reflect the path to your XenForo installation.
   #RewriteBase /xenforo

   #   This line may be needed to enable WebDAV editing with PHP as a CGI.
   #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

   RewriteCond %{REQUEST_FILENAME} -f [OR]
   RewriteCond %{REQUEST_FILENAME} -l [OR]
   RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule ^.*$ - [NC,L]
   RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
   RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Zuletzt bearbeitet von einem Moderator:
Zuerst einmal bitte die Codeschnipsel immer im passenden BBCode darstellen, das hilft einfach bei der besseren Übersicht.. ;)

Zum anderen sehe ich direkt dein Fehler. Das RewriteEngine On sollte immer nur einmal da stehen, bei dir sorgt die erste Zeile dafür das die weiteren Rewrite Regeln nicht mehr wirken.
Nutze diese .htaccess und sag uns das Ergebnis.

Code:
#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{HTTPS} !=on
   RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

   #   If you are having problems with the rewrite rules, remove the "#" from the
   #   line that begins "RewriteBase" below. You will also have to change the path
   #   of the rewrite to reflect the path to your XenForo installation.
   #RewriteBase /xenforo

   #   This line may be needed to enable WebDAV editing with PHP as a CGI.
   #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

   RewriteCond %{REQUEST_FILENAME} -f [OR]
   RewriteCond %{REQUEST_FILENAME} -l [OR]
   RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule ^.*$ - [NC,L]
   RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
   RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Hm, bleibt aber das gleiche Problem bei Aktivierung der Funktion im XF-Adminbereich. :confused:

unbenannt6jsnu.png
 
probier mal die, ggf ohne die force parts...

Code:
RewriteEngine On
RewriteBase /

#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default


# Force the "https"
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.**********.com/$1 [R,L]


# Force the "www."
RewriteCond %{HTTP_HOST} !^www\.**********\.com$ [NC]
RewriteRule ^(.*)$ https://www.**********.com/$1 [R=301,L]


    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #       RewriteBase /kunden/homepages/**********/htdocs/**********/xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
 
Zuletzt bearbeitet:
Hey,

ich hake mich mal kurz ein.

Ich möchte das www.Domain.de zu domain.de weitergeleitet wird (was funktioniert).

Was nicht funktioniert, ist die Rewrite Regel für den SSL Zwang.

Code:
#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
   RewriteEngine On

# no www. attached

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


   #   If you are having problems with the rewrite rules, remove the "#" from the
   #   line that begins "RewriteBase" below. You will also have to change the path
   #   of the rewrite to reflect the path to your XenForo installation.
   RewriteBase /

   #   This line may be needed to enable WebDAV editing with PHP as a CGI.
   #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

   RewriteCond %{REQUEST_FILENAME} -f [OR]
   RewriteCond %{REQUEST_FILENAME} -l [OR]
   RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule ^.*$ - [NC,L]
   RewriteRule ^(mail/|faq/|data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
   RewriteRule ^.*$ index.php [NC,L]
</IfModule>

# SSL

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
 
Deine .HTACCESS müsste so aussehen. Deine letzte Regel SSL greift nicht mehr, da ausserhalb des IfModule ..

Code:
#   Mod_security can interfere with uploading of content such as attachments. If you
#   cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#   SecFilterEngine Off
#   SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
   RewriteEngine On

# no www. attached and SSL

RewriteCond %{HTTP_HOST} !^xxx\.de$ [NC] OR
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://xxxx.de/$1 [L,R=301]

   #   If you are having problems with the rewrite rules, remove the "#" from the
   #   line that begins "RewriteBase" below. You will also have to change the path
   #   of the rewrite to reflect the path to your XenForo installation.
   RewriteBase /

   #   This line may be needed to enable WebDAV editing with PHP as a CGI.
   #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

   RewriteCond %{REQUEST_FILENAME} -f [OR]
   RewriteCond %{REQUEST_FILENAME} -l [OR]
   RewriteCond %{REQUEST_FILENAME} -d
   RewriteRule ^.*$ - [NC,L]
   RewriteRule ^(mail/|faq/|data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
   RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Hey Atze,

vielen Dank, aber ich habe weiterhin ein Problem.

Rufe ich modellbau-nation.de auf, ist die Verbindung unverschlüsselt.

Rufe ich www.modellbau-nation.de auf, leitet es auf ohne www weiter und die Verbindung ist gesichert.

Ich habe ein Zertifikat welches für www. und auch ohne www. gültig ist.

Ich bräuchte also noch eine Regel für "modellbau-nation.de" auf Modellbau-Nation - Das Modellbau Forum für die ganze Nation weiterleitet.
 
Ich habe bei mir zum Beispiel ..

Code:
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R=301,L]
 
Zurück
Oben