Page 1 of 1

HtAccess again

Posted: Sat May 28, 2022 9:32 pm
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)

Re: HtAccess again

Posted: Wed Jun 01, 2022 3:23 pm
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

Re: HtAccess again

Posted: Thu Jun 02, 2022 12:18 am
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.

Re: HtAccess again

Posted: Thu Jun 02, 2022 5:40 pm
by Kwai chang caine
Thanks a lot for your precious help WEBMASTER 8)
I PM you :wink:
Have a very good day