The Little Guy Posted December 21, 2007 Share Posted December 21, 2007 Can I make a file, so that when my page reads a URL like: somedomain.hostbox.us it reads it into a file like this: hostbox.us/readFile.php?url=somedomain another way: somedomain.hostbox.us/somedir/mypage.php and it reads it into a file like this: hostbox.us/readFile.php?url=somedomain&page=somedir/mypage.php Quote Link to comment Share on other sites More sharing options...
revraz Posted December 21, 2007 Share Posted December 21, 2007 Should be able to do that with .htaccess if you have access to it. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 I do! Want to point me in the right direction? I can not figure out how I would do this. I have searched high and low on google, and I can not seem to find anything out. Please Help! Thanks. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 21, 2007 Share Posted December 21, 2007 Setting up some sort of custom subdomain situation seems to be your focus right now. Honestly, these types of things are handled by Apache, and you really should take this to the appropriate board if you want the best help with it... PhREEEk Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 What might actually be a better Idea, If possible, would be to make user1.hostbox.us be a root directory in here, where user1 is the root: users | +-- user1 | +-- user2 | +-- user3 Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 Setting up some sort of custom subdomain situation seems to be your focus right now. Honestly, these types of things are handled by Apache, and you really should take this to the appropriate board if you want the best help with it... PhREEEk I don't have access to apache, only Htaccess, and custom php ini files. Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 21, 2007 Share Posted December 21, 2007 If you have a hosting package, your package either comes with x number of subdomains or not. If not, and you create them anyways, you would likely be violating your TOS with your hosting company. If you have access to .htaccess, .htaccess IS a document used by Apache, so it is an Apache issue... PhREEEk Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 21, 2007 Share Posted December 21, 2007 There was an article last week on here explaining how to do this using mod_rewrite from a .htaccess file Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 OK, I will agree with that. I have unlimited domains/subdomains. But... I don't think I want to use "Actual" subdomains, I would just like to use "Fake" subdomains, if that is possible. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 There was an article last week on here explaining how to do this using mod_rewrite from a .htaccess file Any links to it? Quote Link to comment Share on other sites More sharing options...
rarebit Posted December 21, 2007 Share Posted December 21, 2007 mmm, I did a quick search for any post's with 'subdomain' in the title, only in the past 21 day's. Only three result's, so I looked for you and guess what, found it! topic,170713.0.html Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 RewriteCond %{HTTP_HOST} !^www\. RewriteCond %{HTTP_HOST} ^([^.]+)\.hostbox\.us RewriteRule ^/(.*)$ viewFile.php?user=$1 [L] I tried that, and all I get is a "Server not found" error on this: http://test.hostbox.us/ viewFile.php does exist, and it contains this text: <?php echo $_GET['user']; ?> Any Ideas? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 21, 2007 Share Posted December 21, 2007 This was the first result searching google for htaccess subdomains http://www.webmasterworld.com/forum92/3555.htm Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 21, 2007 Author Share Posted December 21, 2007 OK, here is what I have now! RewriteEngine On Options -MultiViews #RewriteCond %{REQUEST_URI}!^/sd_ #RewriteCond %{HTTP_HOST}!^www\.hostbox\.us [NC] #RewriteCond %{HTTP_HOST} ^([^.]+)\.hostbox\.us #RewriteRule (.*) /sd_%1/$1 [L] RewriteCond %{HTTP_HOST} !^www\.hostbox\.us RewriteCond %{HTTP_HOST} ([^.]+)\.hostbox\.us [NC] Options +FollowSymlinks RewriteRule ^http://(.*)\.hostbox\.us$ http://hostbox.us/viewFile.php?user=$1 [L,R] basically it works, the problem is that it only shows the root folder tree of my hostbox.us folder. It isn't loading viewFile.php in the background anyone know why? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 22, 2007 Author Share Posted December 22, 2007 Boink. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 24, 2007 Author Share Posted December 24, 2007 Looks like I got it!! Options +FollowSymLinks RewriteEngine On # Fix missing trailing slashes. RewriteCond %{HTTP_HOST} !^(www\.)?hostbox\.us$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.hostbox\.us$ [NC] RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L] # Rewrite sub domains. RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} !^(www\.)?hostbox\.us$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.hostbox\.us$ [NC] RewriteRule ^(.*)$ subdomains/%2/$1 [QSA,L] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.