Henrik Posted November 10, 2006 Share Posted November 10, 2006 I am trying to use parked domains as managed domains in a wiki farm environment, so I want to mimic frame forwarding or phantom domains.As a test I enter this into the browser: http://bechmann.ca/projects/frontpage.htmland have this in .htaccess:RewriteEngine onRewriteBase /RewriteCond %{HTTP_HOST} ^bechmann\.ca$ [OR]RewriteCond %{HTTP_HOST} ^www\.bechmann\.ca$RewriteRule ^$ osscommons/home/osscommons.html [L]RewriteCond %{HTTP_HOST} ^bechmann\.ca$ [OR]RewriteCond %{HTTP_HOST} ^www\.bechmann\.ca$RewriteRule ^([^/]+)/([a-z.]+)$ osscommons/$1/$2 [L]which works, but is not general enough.But when I substituteRewriteRule ^([^/]+)/(*+)$ osscommons/$1/$2 [L]for the last line, I get Internal Error and when I doRewriteRule ^(*+)$ osscommons/$1 [L]I also get an internal server error.Can anyone explain?Thanks!- Henrik Link to comment https://forums.phpfreaks.com/topic/26849-regex-mysteries/ Share on other sites More sharing options...
Henrik Posted March 23, 2007 Author Share Posted March 23, 2007 In case anyone is interested I have since found a solution:RewriteEngine onRewriteBase /#allow subdomainsRewriteCond %{HTTP_HOST} !^(www\.)?([^.]*)(\.ca|\.com|\.org)$RewriteRule ^ - [L]#collect core domain name (coreName)RewriteCond %{HTTP_HOST} ^(www\.)?([^.]*)(\.ca|\.com|\.org)$RewriteRule ^ - [E=coreName:%2]#specific exceptions...RewriteCond %{ENV:coreName} ^bechmannsoftware$RewriteRule ^(.*)$ http://software.bechmann.ca/$1 [R,L]RewriteCond %{ENV:coreName} ^politicalreader$RewriteRule ^(.*)$ http://politics.ireader.ca/$1 [R,L]RewriteCond %{ENV:coreName} ^economicsreader$|^governancereader$|^newsreader$RewriteCond %{ENV:coreName} ^(.+)reader$RewriteRule ^(.*)$ http://%1.ireader.ca/$1 [R,L]#RewriteCond %{ENV:coreName} ^bechmann$#RewriteRule ^(.*)$ http://software.bechmann.ca/$1 [R,L]RewriteCond %{ENV:coreName} ^dufferinpark$|^parkcommons$|^communitycommons$|^businesscommons$RewriteRule ^ - [L]#generic handling...#provide file request: index.php if available or index.html by defaultRewriteCond %{DOCUMENT_ROOT}/%{ENV:coreName}/index.php -fRewriteRule ^$ http://%{HTTP_HOST}/index.php [R,L]RewriteRule ^$ http://%{HTTP_HOST}/index.html [R,L]#add missing trailing / for directory requests to avoid reversion to cananical domainRewriteCond $1 ![.]RewriteCond %{DOCUMENT_ROOT}/%{ENV:coreName}/$1 -dRewriteRule ^(.+[^/])$ http://%{HTTP_HOST}/$1/ [R,L]#prevent recursion through sentinel fileRewriteCond %{DOCUMENT_ROOT}/$1/%{ENV:coreName}.identifier.DoNotTouch -fRewriteRule ^([^/]*) - [S=2]#hack for pmwiki re form url parameter - replace wiki.php/ with wiki.php?n=RewriteRule ^(.*/wiki.php)(/)(.*)$ http://%{HTTP_HOST}/$1?n=$3 [QSA,R,L]#silently insert subdirectory for public dataRewriteRule ^(.*)$ %{ENV:coreName}/$1Note that this requires a sentinel file in each directory to stop recursion.- Henrik Link to comment https://forums.phpfreaks.com/topic/26849-regex-mysteries/#findComment-213586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.