Quantcast
Channel: Server / .htaccess – Marcel Schmidt Wiki / Neuigkeiten
Viewing all articles
Browse latest Browse all 6

.htaccess 301 redirects für URLs

$
0
0

Für die Nicht Techniker unter uns:

(A) wenn html oder php ohne Parameter im Zielpfad dann „?“ anhängen
Alt-URL:
#127.0.0.1/test/shop/index.php?main_page=product_info&cPath=3_18_29&products_id=662

1
2
3
Rewrite Zeilen für .htaccess:
RewriteCond %{QUERY_STRING} products_id=662
RewriteRule !^index\.php$ http://danmoi.com/de/einfache-maultrommel-klassische-form.html? [R=301,L]

(B) wenn Ordner im Zielpfad dann „?“ anhängen
Alt-URL:
#127.0.0.1/test/shop/index.php?cPath=41&main_page=index

1
2
3
Rewrite Zeilen für .htaccess:
RewriteCond %{QUERY_STRING} cPath=41&main_page=index
RewriteRule !^index\.php$ http://danmoi.com/en/? [R=301,L]

#127.0.0.1/test/shop/index.php?main_page=product_info&cPath=77&products_id=891

(C) wenn html oder php mit Parameter im Zielpfad dann „&“ anhängen
Alt-URL:
#127.0.0.1/test/shop/index.php?suche=gong

1
2
3
Rewrite Zeilen für .htaccess:
RewriteCond %{QUERY_STRING} suche=gong
RewriteRule !^index\.php$ http://www.danmoi.com/de/catalogsearch/result/?q=gong& [R=301,L]

(D) Alle anderen Aufrufe weiterleiten:

1
2
3
Rewrite Zeilen für .htaccess:
RewriteCond %{HTTP_HOST} ^www\.danmoi\.de$
RewriteRule ^(.*)$ http://www.danmoi.com? [L,R=301]

Für die Techniker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
RewriteEngine On
#Ohne Quellparameter im Zielpfad
#wenn html oder php ohne Parameter dann "?" anhängen
#wenn html oder php mit Parameter dann "&" anhängen
#wenn Ordner dann "?" anhängen
RewriteCond %{QUERY_STRING} main_page=product_info&cPath=77&products_id=891
RewriteRule !^index\.php$ http://danmoi.com/de/percussion/trommeln.html? [R=301,L]
RewriteCond %{QUERY_STRING} products_id=662
RewriteRule !^index\.php$ http://danmoi.com/de/einfache-maultrommel-klassische-form.html? [R=301,L]
RewriteCond %{QUERY_STRING} cPath=41&main_page=index
RewriteRule !^index\.php$ http://danmoi.com/en/? [R=301,L]
#127.0.0.1/test/shop/index.php?main_page=product_info&cPath=3_18_29&products_id=662
#127.0.0.1/test/shop/index.php?main_page=product_info&cPath=77&products_id=891
#127.0.0.1/test/shop/index.php?cPath=41&main_page=index
 
#Alle anderen aufrufe weiterleiten:
RewriteCond %{HTTP_HOST} ^www\.danmoi\.de$
RewriteRule ^(.*)$ http://www.danmoi.com? [L,R=301]

Viewing all articles
Browse latest Browse all 6