Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [inne]przekierowania w .HTACCESS
northwest
post
Post #1





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


Witam serdecznie,
chciałbym zrobić przekierowanie z 2 domen na 1.
Załóżmy że mam domenę domena1.pl, domena2.pl i domena3.pl. 2 i 3 chce przekierować na domenę 1 (z www i bez niego).

Czyli www.domena2.pl, domenta2.pl , domena3.pl, www.domena3.pl - po wpisaniu tych adresów chce przekierować na www.domena1.pl

Kombinuję z takim czymś:
  1. RewriteBase /
  2. RewriteCond %{HTTP_HOST} ^domena2.pl
  3. RewriteRule ^(.*)$ <a href="http://www.domena1.pl/$1" target="_blank">http://www.domena1.pl/$1</a> [R=301,L]
  4.  
  5. RewriteCond %{HTTP_HOST} ^domena3.pl
  6. RewriteRule ^(.*)$ <a href="http://www.domena1.pl/$1" target="_blank">http://www.domena1.pl/$1</a> [R=301,L]
  7.  
  8. RewriteCond %{HTTP_HOST} ^domena1.pl
  9. RewriteRule ^(.*)$ <a href="http://www.domena1.pl/$1" target="_blank">http://www.domena1.pl/$1</a> [R=301,L]


ale niestety nie chce to działać sad.gif wiecie może dlaczego?

Northwest
Go to the top of the page
+Quote Post
rocktech.pl
post
Post #2





Grupa: Zarejestrowani
Postów: 587
Pomógł: 131
Dołączył: 8.02.2010

Ostrzeżenie: (0%)
-----


Witam.

To powinno załatwić twój problem.

[APACHE] pobierz, plaintext
  1. RewriteEngine On
  2. RewriteCond %{HTTP_HOST} !^domena2.pl$ [NC]
  3. RewriteCond %{HTTP_HOST} !^domena3.pl$ [NC]
  4. RewriteRule ^(.*)$ ht*tp://domena1.pl/$1 [R,L]
[APACHE] pobierz, plaintext


Oczywiście usuń gwiazdkę pomiędzy ht*tp (problem z formatowaniem przez parser BB CODE).

Ten post edytował rocktech.pl 27.03.2012, 12:30:29


--------------------
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. --Brian Moore

I never go looking for a sucker. I look for a Champion and make a sucker of of him. --Amarillo Slim


Home-made : js-gui-classes | Accordion | Tabs | Carousel / php-sms-classes | Obsługa bramki SMS MultiInfo | Obsługa bramki SMS Mobiltek
Go to the top of the page
+Quote Post
Necsord
post
Post #3





Grupa: Zarejestrowani
Postów: 189
Pomógł: 60
Dołączył: 5.10.2010
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


[APACHE] pobierz, plaintext
  1. RewriteEngine On
  2. RewriteBase /
  3. RewriteCond %{HTTP_HOST} ^(www\.)?domena2.pl$ [OR]
  4. RewriteCond %{HTTP_HOST} ^(www\.)?domena3.pl$
  5. RewriteRule ^(.*)$ http://www.domena1.pl/$1 [R=301,L]
[APACHE] pobierz, plaintext


Z www lub bez.

Ten post edytował Necsord 27.03.2012, 12:54:08
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 01:12