Server Fault Asked by FFish on July 28, 2020
I need to point subdomains like es.domain.com
to /public/www/index.php
The problem is my host does NOT provide me to set a path, I can only set up the subdomains for “local use”, which creates the folders in the public
directory
My structure is
/public/
/public/de/
/public/es/
/public/it/
/public/www/index.php
My host told me to use .htaccess files inside the sub domain folders.
I tried, for example in /public/es/
something like
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(de|es|it).mydomain.com$
# Create an environment variable to remember the language:
RewriteRule (.*) - [QSA,E=LANGUAGE:%1]
# Now check if the LANGUAGE is empty (= doesn't exist)
RewriteCond %{ENV:LANGUAGE} !^$
# If so, create the default language (=es):
RewriteRule (.*) - [QSA,E=LANGUAGE:es]
# Change the root folder of the spanish language:
RewriteCond %{ENV:LANGUAGE} ^es$
# Change the root folder:
RewriteRule ^/?$ /public/www/index.php
</IfModule>
But I am getting a 404 on this:
The requested URL /public/www/index.php was not found on this server.
In my DNS list I see that
es.domain.com
CNAME onlinux-it.setupdns.net
while
www.domain.com
CNAME domain.com
I tried also assigning
es.domain.com
CNAME to domain.com
but that did not change anything.
You wrote:
In my DNS list I see that
es.domain.com
CNAMEonlinux-it.setupdns.net
whilewww.domain.com
CNAMEdomain.com
Maybe the problem is about your DNS configuration.
My own DNS configuration is something like:
$TTL 86400
@ IN SOA dnsxx.ovh.net. tech.ovh.net. (2011111300 86400 3600 3600000 86400)
IN NS dnsxx.ovh.net.
IN NS nsxx.ovh.net.
IN A 123.123.123.123
* IN CNAME papdevis.fr.
This means "if you type papdevis.fr
or whatever behind i.e. www.papdevis.fr
or olivier.papdevis.fr
go to the server at the adress 123.123.123.123
.
If I change the adress 123.123.123.123
to a new one for example 234.234.234.234
, this will work and as soon as you'll type papdevis.fr
or any other stuff (like explained before) it will go to 234.234.234.234
. Everything will work smoothlessly without touching any .htaccess
file.
So try to apply the same DNS configuration on your site.
Answered by Olivier Pons on July 28, 2020
The best way would be to change the DocumentRoot
directive in your Apache config files for those sobdomains so that they all point to /public/www/
but I guess you can't do that.
I don't think there's any way to do what you are asking with a .htaccess
file.
You could create a symlink instead of a folder so that:
/public/de/ -> /public/www/
Are you able to do that?
Answered by Ladadadada on July 28, 2020
2 Asked on January 10, 2021 by renaud-bompuis
1 Asked on January 9, 2021 by chandima-jayawickrema
1 Asked on January 9, 2021 by ajprames
1 Asked on January 9, 2021
attachment email bounces email server exchange mobile devices
0 Asked on January 9, 2021 by abhishek-divekar
0 Asked on January 9, 2021 by casady
0 Asked on January 9, 2021 by selfishcrawler
0 Asked on January 9, 2021 by user2033464
0 Asked on January 8, 2021 by angelo-sossela
0 Asked on January 7, 2021 by hrvoje-batrnek
1 Asked on January 6, 2021 by saabeilin
0 Asked on January 5, 2021 by ashish-kumar-dubeyitho-noidain
4 Asked on January 5, 2021 by thecleaner
2 Asked on January 5, 2021 by lapinkoira
2 Asked on January 5, 2021 by adrime
1 Asked on January 5, 2021 by user395062
internal dns microsoft office 365 outlook windows 7 windows server 2016
Get help from others!
Recent Questions
Recent Answers
© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP