Umleitungen mit der .htaccess

Reditect all with www

1
2
3
4
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect to other URL

1
2
3
4
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.old-site.com$ [NC]
RewriteRule ^ http://www.new-site.com? [R=301]


Redirect To SSL Using Apache’s .htaccess

1
2
3
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Require no “www”

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

Prevent Hotlinking

1
2
3
4
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/ .*$ [NC]
RewriteRule \.(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]

Redirect Multiple Domains to a Single Domain

1
2
3
4
5
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.net$ [NC,OR]
RewriteCond %{HTTP_HOST} ^domain.net$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain.net$ [NC]
RewriteRule ^(.*)$ http://domain.net/$1 [R=301,L]

Redirect to Maintenance Page

1
2
3
4
5
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/offline.html$
RewriteRule .* /offline.html [R=307,L]
Dieser Beitrag wurde unter Internet, Wordpress abgelegt und mit , , , , , , , , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.