/    Sign up×
Community /Pin to ProfileBookmark

Different directory index file domain vs. subdomain

Is there a way to show different index pages according to whether page is accessed either via “www.domain.ext/directory/” or “www.directory.domain.ext/”?

Lets say I want to show “index.shtml” when visiting “www.domain.ext/directory/”, but I want to show “default.shtml” when visiting “www.directory.domain.ext/”.

Anyone? ?

to post a comment
Full-stack Developer

7 Comments(s)

Copy linkTweet thisAlerts:
@PeOfEoJun 26.2004 — But it is essentially the same physical and virtual directory so the same default file will be there... well here is what you do, get out your server side language and at the top of both pages run a script, say
<i>
</i>if request.ServerVariables("URL") = <a href="http://www.directory.domain.ext/">http://www.directory.domain.ext/</a> then
response.redirect("index.shtml")
end if

Then on the other put in the reverse. That code is vb... same for vb.net and script... so if you have asp or asp.net what I just wrote will work. You can do the same thing with php though, its just changeing the syntax a little, same idea though.
Copy linkTweet thisAlerts:
@philawebauthorJun 26.2004 — [B]PeOfEo[/B],

Problem is this server supports SSI "virtual include", but only for directories - not subdomains. So, pages accessed via subdomains doesn't work properly, unless I can come up with some sort of workaround.
Copy linkTweet thisAlerts:
@PeOfEoJun 26.2004 — Does your server support a server side scripting language?
Copy linkTweet thisAlerts:
@philawebauthorJun 26.2004 — [B]PeOfEo[/B],

I realize my initial post looks confusing since I mentioned two .shtml files. Looks like a logical loop to me with no real good answer.... :rolleyes:

BTW... Thanks you for that neat script you gave me. What is the correct syntax for it? <script></script> etc.?
Copy linkTweet thisAlerts:
@philawebauthorJun 26.2004 — [i]Originally posted by PeOfEo [/i]

[B]Does your server support a server side scripting language? [/B][/QUOTE]


Yes, PHP. ?

Still have to learn PHP include though - well, even how to write PHP pages. ?
Copy linkTweet thisAlerts:
@PeOfEoJun 26.2004 — [i]Originally posted by philaweb [/i]

[B]Yes, PHP. ?



Still have to learn PHP include though - well, even how to write PHP pages. ? [/B]
[/QUOTE]
so just do the includes with php.

http://www.w3schools.com/php/php_includes.asp

That code I wrote above in my first post would be a server side script that would redirect the user to the correct page to do the include, but that script was vb.net/vbscript, so its asp(.net) not php... it was a work around and can easily be written with php, but if you have a server side language like php or asp you might as well just do the include in one of those to begin with.
Copy linkTweet thisAlerts:
@philawebauthorJun 26.2004 — [i]Originally posted by PeOfEo [/i]

[B]so just do the includes with php.[/B][/QUOTE]


Thanks! I'll have a go at this... ?
×

Success!

Help @philaweb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...