Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> mod-rewrite
HdwaO
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 27.02.2006

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


Witam

Mam wielki problem z zoptymalizowaniem wpisu do .htaccess nasz serwis ma kilka domen dla których chcialibyśmy żeby subdomeny wskazywały te same miejsca (katalog o nazwie subdomeny), np.
  1. RewriteEngine On
  2. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena.domena.pl$ [NC]
  3. RewriteRule ^(.*)$ /subdomena/ [L]
  4. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena.domena.org$ [NC]
  5. RewriteRule ^(.*)$ /subdomena/ [L]
  6. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena.domena.biz$ [NC]
  7. RewriteRule ^(.*)$ /subdomena/ [L]
  8. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena.domena.info$ [NC]
  9. RewriteRule ^(.*)$ /subdomena/ [L]
  10. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena.domena.net$ [NC]
  11. RewriteRule ^(.*)$ /subdomena/ [L]
  12. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena2.domena.pl$ [NC]
  13. RewriteRule ^(.*)$ /subdomena2/ [L]
  14. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena2.domena.org$ [NC]
  15. RewriteRule ^(.*)$ /subdomena2/ [L]
  16. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena2.domena.biz$ [NC]
  17. RewriteRule ^(.*)$ /subdomena2/ [L]
  18. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena2.domena.info$ [NC]
  19. RewriteRule ^(.*)$ /subdomena2/ [L]
  20. RewriteCond %{HTTP_HOST} ^(www\.)?subdomena2.domena.net$ [NC]
  21. RewriteRule ^(.*)$ /subdomena2/ [L]

Powyższy przykład przekierowuje subdomene na katalog. Jak możnaby uprościc ten wpis tak, żeby nie trzeba było dodawać kolejnych wpisów dla kolejnych subdomen.

Z góry dziękuje za pomoc

Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Łukasz O.
post
Post #2





Grupa: Zarejestrowani
Postów: 191
Pomógł: 5
Dołączył: 13.01.2007

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


  1. <?php
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^(www.)?([w]+).domena.(pl|org|biz|info|net)[NC]
  4. RewriteRule ^(.*)/$1/ [L]
  5. ?>

chyba coś takiego - nie testowałem;)
Go to the top of the page
+Quote Post
HdwaO
post
Post #3





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 27.02.2006

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


Powyższy problem rozwiązałem w ten sposób:

  1. RewriteEngine On
  2. RewriteCond %{HTTP_HOST} !^(www\.)?domena\.(pl|org|biz|info|net)$ [NC]
  3. RewriteCond %{HTTP_HOST} ^(www\.)?(.*).domena.(pl|org|biz|info|net)$ [NC]
  4. RewriteRule .* /%2%{REQUEST_URI}


Pozdrawiam
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 19.09.2025 - 09:44