?
Solved

Apache .htaccess subdomains ?

Posted on 2006-05-02
2
Medium Priority
?
362 Views
Last Modified: 2012-06-27
I need .htaccess file that would allow me to access my site with any subdomain. For example if i type sub1.site.com or sub2.site.com... that show me file sub1.txt or sub2.txt.. but i i want that subdomain stays the same.


example:

http://subb1.site.com/ to show sub1.txt without redirection to sub1.txt, so http://subb1.site.com/ must stay in link bar.


Thank you !
0
Comment
Question by:65zgtre45rr
2 Comments
 
LVL 10

Expert Comment

by:sleep_furiously
ID: 16591105
Try:

DirectoryIndex sub1.txt
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 100 total points
ID: 16593953
> if i type sub1.site.com or sub2.site.com... that show me file sub1.txt or sub2.txt.

You'll need mod_rewrite for that

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.site\.com
RewriteRule ^$ /%1.txt [L]
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
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 …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

864 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