Portál AbcLinuxu, 13. května 2025 21:43
Zdravím,
za včerejšek jsem prošel dobrých 30 metod jak si pořešit subdomény, potřebuju takhle podstrčit:
blog.kdyby.org -> kdyby.org/blog.php
download.kdyby.org -> kdyby.org/download.php
libs.kdyby.org -> kdyby.org/libs.php
a potom chci mít dynamické subdomény ve složce /subdomains takze treba
test1.kdyby.org -> kdyby.org/subdomains/test1
test2.kdyby.org -> kdyby.org/subdomains/test2
test3.kdyby.org -> kdyby.org/subdomains/test3
Poskládal jsem rewrite který by měl fungovat podle asi 20ceti návodů
ovšem řve na mě krásná 500
RewriteEngine On
RewriteCond %{HTTP_HOST} ^kdyby\.org [NC]
RewriteRule ^(.*)$ http://www.kdyby.org/$1 [R=301,QSA,L]
RewriteCond %{HTTP_HOST} ^([a-z][a-z0-9]+)\.kdyby\.org$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{1} ^(blog|download|libs|documentation|helper)$ [NC]
Rewriterule ^(.*)$ %{DOCUMENT_ROOT}/%{1}.php [L]
RewriteCond %{HTTP_HOST} ^([a-z][a-z0-9]+)\.kdyby\.org$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{1} !^(blog|download|libs|documentation|helper)$ [NC]
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/subdomains/%{1}/index.php [L]
Kamarád mi dal k dispozici svůj rewrite který ma použitý a funguje
RewriteCond %{HTTP_HOST} ^[^.]+\.aeternum.cz$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.aeternum.cz(.*) /var/www/web.aeternum.cz$2
Tak jsem si ho upravil, ovšem blog.kdyby.org mi hází 500 a barak.kdyby.org mi hází Forbidden
RewriteCond %{HTTP_HOST} ^([^.]+)\.kdyby\.org$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(blog|download|libs|documentation|helper)\.kdyby\.org$ [NC]
RewriteRule ^(.+)$ %{HTTP_HOST}$1 [C]
RewriteRule ^([^\.]+)\.kdyby\.org(.*) %{DOCUMENT_ROOT}/$2.php [L]
RewriteCond %{HTTP_HOST} ^([^.]+)\.kdyby\.org$ [NC]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !^(blog|download|libs|documentation|helper)\.kdyby\.org$ [NC]
RewriteRule ^(.+)$ %{HTTP_HOST}$1 [C]
RewriteRule ^([^\.]+)\.kdyby\.org(.*)$ %{DOCUMENT_ROOT}/subdomains/$2/index.php [L]
Ten forbidden vypadá takhle (docela úlet):
Forbidden
You don't have permission to access /subdomains/subdomains/subdomains/subdomains/subdomains/subdomains/subdomains/subdomains/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/subdomains/subdomains/...............
............../index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/subdomains/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/subdomains/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php on this server.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.