Solved

Re-write question - faking subdomains

Posted on 2007-04-01
6
195 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
Comment Utility
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
Comment Utility
Where do I put that?

In my config file?
0
 
LVL 11

Expert Comment

by:JamesCssl
Comment Utility
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 1

Author Comment

by:edvinson
Comment Utility
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
Comment Utility
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
Comment Utility
Havent tried, been busy. But I am sure it will!

Thanks.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now