HtAccess again

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

HtAccess again

Post by Kwai chang caine »

Hello at all :D

I have again a little problem with this complex HtAccess :oops:

I want to create a "dev" folder for all my sites, for can programming without perturbate the real site in folder "web"
So at the begining, the DEV folder is the exact copy of the WEB folder, and all the sites are managed like this on my server :idea:

domain.com/folder1/folder2/folder3/dev/MySite/index.php
domain.com/folder1/folder2/folder3/web/MySite/index.php


Then, if i have for example this subdomain

Code: Select all

http://mysite.domain.com
It points to this adress :
domain.com/folder1/folder2/folder3/web/MySite/index.php
with this RULE :

Code: Select all

RewriteRule "^SITE" "/folder1/folder2/folder3/web/MySite/index.php"

That woks nice, but now...i want create a RULE for explain that if i write :
http://dev.mysite.domain.com
http://dev.mysite2.domain.com
etc ...
So adding "dev." before each normal adress


HtAccess must modify the adress of
domain.com/folder1/folder2/folder3/web/MySite/index.php
to
domain.com/folder1/folder2/folder3/dev/MySite2/index.php

If someone have an idea for do this miracle ? :oops:
I wish you a very good night 8)
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: HtAccess again

Post by Kwai chang caine »

Nobody have an introduce of start of begining of commence of introduction of little idea for do that ? :|
Perhaps the question is a "little bit" too much long and ununderstandable :oops:

In few words (finally i try) if I type "SubDomain1.Domain.fr" currently i'm directed to:

Code: Select all

domain.fr/folder1/folder2/folder3/web/MySite1/index.php
Or "SubDomain2.Domain.fr" currently i'm directed to;

Code: Select all

 domain.fr/folder1/folder2/folder3/web/MySite2/index.php
etc ... and it works very well
But I would like for all my sites, to replace the name of a folder "/web/" by "/dev/" only if I add a "dev." before the url

If I type "dev.SousDomain1.Domain.fr" i want be directed to:

Code: Select all

domain.fr/folder1/folder2/folder3/dev/MySite1/index.php
ImageThe happiness is a road...
Not a destination
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: HtAccess again

Post by normeus »

KCC,
I just came back from Holiday.
What you are trying to do ( I hope, I understand ) can be accomplished in your control panel. In cPanel if that's what you are using, create the subdomain and point to to your web folder:

Code: Select all

subdomain:     dev.subdomain1.domain.fr
domain:        domain.fr
Document Root: folder1/folder2/folder3/web/MySite1
(notice that the domain is not in the document root description and we are not creating a new folder, but pointing to old folder)
If you already created the subdomain and it points to another folder, cPanel has an option to forward the subdomain to whichever domain you want. Just forward to:

Code: Select all

folder1/folder2/folder3/web/MySite1
With this second option, you can also delete the "dev.subdomain1.domain.fr" which is pointing to the wrong folder. Be careful when deleteing stuff!!! and recreate it to point to the right folder.
If you did not create the subdomain using control panel, but instead used DNS to create a CNAME to point to domain then you can use .htaccess for the main server to point to the folder you want. ( for this one, I would need more info.) Send me a PM if you have more info on the subject.

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: HtAccess again

Post by Kwai chang caine »

Thanks a lot for your precious help WEBMASTER 8)
I PM you :wink:
Have a very good day
ImageThe happiness is a road...
Not a destination
Post Reply