.htaccess für https Umleitung anpassen (Option wieder zurück zu den alten URLs)

Maestro2k5

Bekanntes Mitglied
Lizenzinhaber
Registriert
28. März 2013
Beiträge
3.201
Punkte
178
XF Version
  1. 2.2.10 PL1
XF Instanz
Hosting
PHP-Version
8.1,x
MySQL/MariaDB
10.5.x
Provider/Hoster
Dogado
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 500 default

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

            RewriteCond %{HTTP_HOST} !^www\.android-port\.de [NC]
               RewriteRule ^(.*)$ http://www.android-port.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.
       

        #    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) - [NC,L]
        RewriteRule (robots\.txt)$ robots.php [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>


<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-shockwave-flash
</IfModule>


<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
</IfModule>

<IfModule mod_deflate.c>
<FilesMatch "\\.(js|css|html|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

Ich möchte das gerne anpassen so das alle Links egal ob sie mit und ohne www oder mit und ohne http kommen nun auf https weitergeleitet werden.

Es wäre auch toll wenn mir jemand noch ein Tip gibt wie ich das ganze dann notfalls noch rückgängig machen kann.
 
ich würde mal vermuten, du kannst das per

Code:
RewriteCond %{REQUEST_SCHEME} !^https [NC]
bzw.

Code:
RewriteCond %{HTTPS} !^on [NC]
kontrollieren
und dann als Rule
Code:
RewriteRule ^(.*)$ https://www.android-port.de/$1 [L,R=301]
die non-https Weiterleitung oben solltest du aber in dem Fall auch anpassen

einzufügen wäre das IMO gleich nach
Code:
RewriteBase /
 
Ich habe das jetzt so:

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 500 default

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

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

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !(/$)
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://www.android-port.de/$1 [R=301,L]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://www.android-port.de/$1 [L]

            #RewriteCond %{HTTP_HOST} !^www\.android-port\.de [NC]
              #RewriteRule ^(.*)$ http://www.android-port.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.
       

        #    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) - [NC,L]
        RewriteRule (robots\.txt)$ robots.php [NC,L]
        RewriteRule ^.*$ index.php [NC,L]
    </IfModule>


<IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE text/javascript
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/atom_xml
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/x-shockwave-flash
</IfModule>


<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType text/css "access plus 1 week"
 ExpiresByType application/javascript "access plus 1 month"
 ExpiresByType application/x-javascript "access plus 1 month"
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType image/x-icon "access plus 1 year"
 </IfModule>

 <IfModule mod_deflate.c>
 <FilesMatch "\\.(js|css|html|xml)$">
 SetOutputFilter DEFLATE
 </FilesMatch>
 </IfModule>
 
Zurück
Oben