Jump to content

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!

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.