Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> mod-rewrite
HdwaO
post 13.03.2007, 09:39:02
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
Łukasz O.
post 13.03.2007, 16:02:25
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;)


--------------------
"Don't tell me you want a bridge - show me the canyon you want to cross" Giuseppe Delena
Go to the top of the page
+Quote Post
HdwaO
post 21.03.2007, 09:07:28
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
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.06.2025 - 06:17