Solved

Re-write question - faking subdomains

Posted on 2007-04-01
6
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
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 …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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