Solved

Re-write question - faking subdomains

Posted on 2007-04-01
6
201 Views
Last Modified: 2010-03-04
I would like 'fake' a subdomain.

If the user enters:  someUsername.mysite.com

I would like the actual page to be:

mysite.com/?someUsername

Also have more questions, but will save them for once this gets working.

Thanks

0
Comment
Question by:edvinson
  • 3
  • 3
6 Comments
 
LVL 11

Expert Comment

by:JamesCssl
ID: 18832367
You may try something like this:

RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
RewriteRule ^.*$ /%1

replace example.com with your domain
0
 
LVL 1

Author Comment

by:edvinson
ID: 18848084
Where do I put that?

In my config file?
0
 
LVL 11

Expert Comment

by:JamesCssl
ID: 18848112
Yes; you could either put it in your httpd.conf if you have access to it, or in your .htaccess file.  You may have to add the following line before the code I provided above:
RewriteEngine On

so:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
RewriteRule ^.*$ /\?%1
0
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 
LVL 1

Author Comment

by:edvinson
ID: 18848145
JamesCssl:

I tried this, and it did not work. I think it's because I am already using a subdomain:

dev.mysite.com

so, I suppose I can't use :  username.dev.mysite.com ?

0
 
LVL 11

Accepted Solution

by:
JamesCssl earned 500 total points
ID: 18873922
So, changing it to:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.dev\.example\.com$ [NC]
RewriteRule ^.*$ /\?%1

doesn't work?
0
 
LVL 1

Author Comment

by:edvinson
ID: 18902334
Havent tried, been busy. But I am sure it will!

Thanks.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question