Forum Moderators: phranque
"example.net" is using real DNS pointed to the webhost running Apache.
other 2 domain "alpha.net" and "beta.org" is forwarded to 2 subfolder in hosting.net
if i use real URL forwarding the URL the user can bookmark the subsets, but the URL will show [hosting.net...] or [hosting.net...]
is there any way which I will modify the URL to show alpha.net/index.html or beta.org/index.html in the address bar while subfolders inside the directory will also be shown? Thank you very much.
[edited by: jdMorgan at 4:16 pm (utc) on May 22, 2005]
[edit reason] Examplified. [/edit]
RewriteEngine on
#
# prevent loops
RewriteCond %{REQUEST_URI}!^/path/to/documentroot
#
# verify a Host: header exists
RewriteCond %{HTTP_HOST} .
#
# pull the middle bit out of the hostname and store it
# in the %2 backreference
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.[a-z] [NC]
#
# Rewrite!
RewriteRule ^(.*) /path/to/documentroot/%2/$1 [L]
You may want to consider setting up your directories like this:
/path/to/documentroot/alpha.net
/path/to/documentroot/beta.org
...and then changing the lastg RewriteCond above to read like this:
RewriteCond %{HTTP_HOST} ^(www\.)?([^:]+) [NC]
This gives you a little more flexibility, and allows for situations in which you're hosting content for 'alpha.net' and 'alpha.com', which are owned by different people.
Does this help?
My rootdirectory is example.net and i have 2 webpage, tacticalcombat.info and savekaitak.info
they are stored in the following path
[example.net...]
and
[example.net...]
I have registered all domain name and the hosting provided forwarding function for all domains. Could you further explain how should i rewrite the code? Thank you very much.
[edited by: jdMorgan at 4:17 pm (utc) on May 22, 2005]
[edit reason] Examplified. [/edit]