Solved

Re-write question - faking subdomains

Posted on 2007-04-01
6
198 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
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). #…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

948 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

22 Experts available now in Live!

Get 1:1 Help Now