Jump to content

How to Rewrite Domains to folders, by apache mod_rewrite?


eurusd

Recommended Posts

How to Rewrite Domains to folders, by apache mod_rewrite?

I have got many domains like this:

Mybestdomain.com

Londondomen.co.uk

Primedomainame.info

Promotion.television.org

Blogging.mysite.com

News.freedomains.co.uk

Tv.news.blogging.net

Internet.news.blogging.net

….

Etc…..

They are all pointing to one ip and to one folder

/home/www/allinone/

All these domains take many files from folder

/home/www/allinone/oftenusedfiles/

/home/www/allinone/oftenusedfiles2/

/home/www/allinone/oftenusedfiles3/

/home/www/allinone/usedfilesabc/

and from /home/www/allinone

$root= _SERVER["DOCUMENT_ROOT"];

 

by include ( $root.”/ oftenusedfiles/usedfunction.inc”);

…… etc ………..

 

 

 

How to do this:

When I enter domain in my browser lets say

http://Mybestdomain.com/ it shows http://Mybestdomain.com/  but goes to

/home/www/allinone/ Mybestdomain.com

Or when I enter domains in my browser for example:

http:// Londondomen.co.uk

it shows same URL but fetches data from Londondomen.co.uk

Basically like this domain name becomes a folder with according name

 

http://%{HOST_NAME}/  --------- /home/www/allinone/%{HOST_NAME}/

 

http://%{HOST_NAME}/script.php?show=45  --------- /home/www/allinone/%{HOST_NAME}/script.php?show=45

 

http://%{HOST_NAME}/%{REQUEST_URI%{QUERY_STRING} --------- /home/www/allinone/%{HOST_NAME}/%{REQUEST_URI}%{QUERY_STRING}

 

 

http:// Blogging.mysite.com  gets data from /home/www/allinone/ Blogging.mysite.com/

http:// Promotion.television.org  gets data from /home/www/allinone/ Promotion.television.org/

….

/home/www/allinone/ Londondomen.co.uk/

/home/www/allinone/ News.freedomains.co.uk/

/home/www/allinone/ Internet.news.blogging.net/

 

Tried all I could nothing works, I really don’t understand reg exp and rewrite

 

RewriteCond %{HTTP_HOST} ^(.+)$ 

 

RewriteRule (.+) /%{HTTP_HOST}/ [QSA,L]

 

RewriteRule  /%{HTTP_HOST}/%{REQUEST_URI} [QSA,L]

 

 

Etc…

 

THANK YOU FOR YOUR HELP!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.