I'm sorry, I've attempted for hrs to obtain this working, however i haven't made progress...

I wish to allow it to be to ensure that if your user on my small site types user.site.com they'll be come to site.com/user, however the URL will still show user.site.com. How do i do that? With .htaccess? Server files?

Use [cde]:


If you wish to connect to assets, either use full (RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !www.site.com$ [NC] RewriteCond %{HTTP_HOST} ^([a-z0-9-_]+).site.com [NC] RewriteRule (.*) %1/$1 [QSA,L] ) or relative (http://site.com/user/static/x.css) Web addresses. Absolute Web addresses (static/x.css) will have to be crafted in a different way if this rule is within effect.

Almost there Ken


%1 = what's before .site.com

$1 = that which you got following the /

For those who have test.site.com/foo.php , you'd have /test/foo.php. should you simply want test, lets forget about the $1.

QSA = query string append, L = Last.

You need to browse the url about mod_rewrite in @phihag publish.

To help keep the initial address within the address bar you may need a reverse proxy as opposed to a redirect. Redirecting informs the browser to transmit another request towards the server having a different address, reverse proxy informs the server to locate another page and send it without notifying the browser about this (this is exactly what you would like In my opinion). Reverse proxy is accomplished using the [P] flag in mod_rewite

Make certain RewriteEngine On RewriteCond %{HTTP_HOST} !www.site.com$ [NC] RewriteCond %{HTTP_HOST} ^([a-z0-9-_]+).site.com [NC] RewriteRule (.*) %1/$1 [QSA,L] , mod_rewrite and mod_proxy are loaded and set the directives


to your virtual host configuration for user.site.com or .htaccess if you don't have root rights. This can proxy all pages in the subdomain towards the primary domain folder. Should you simply want to proxy the index page use <Proxy *> Order deny,allow Allow from all </Proxy> RewriteEngine on RewriteRule ^/(.*) http://site.com/user/$1 [PL] rather.

I suppose you're using http and never https. If that's the case, it will get a bit more complex...