Bonjour à tous,
J'ai un Alias de mon domaine principal. celui-ci pointe vers le fichier .htaccess principal.
J'aimerai avoir un fichier .htaccess diffèrent en fonction du domaine.
Comment faire ?
Merci pour votre aide,
Yo
Bonjour à tous,
J'ai un Alias de mon domaine principal. celui-ci pointe vers le fichier .htaccess principal.
J'aimerai avoir un fichier .htaccess diffèrent en fonction du domaine.
Comment faire ?
Merci pour votre aide,
Yo
Tant que tu n'as pas de répertoire (document root) distinct par sous-domaine, ce ne sera pas facile. Y a quoi dans ton .htaccess ? Si tu n'as que des RewriteRule dedans, c'est possible d'ajouter des conditions par rapport au sous-domaine mais s'il y a d'autres directives, ce n'est pas évident. Faut voir.
Salut _Mac_
Merci pour ta réponse.
J'ai copié ci dessous, mon .htaccess.
Mon but, est de bloquer l'accès par mot de passe (via htacess) à mon domaine principal (site en production), mais de l'essai l'accès libre à son Alias ... ?
Merci pour ton aide,
++ Yo
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190 AuthType Basic AuthName "Merci de vous identifier..." AuthUserFile "/var/www/vhosts/site.fr/httpdocs/.htpasswd" Require valid-user AddType x-mapp-php5 .php .php3 .php4 .htm .html ############################################ ## uncomment these lines for CGI mode ## make sure to specify the correct cgi php binary file name ## it might be /cgi-bin/php-cgi # Action php5-cgi /cgi-bin/php5-cgi # AddHandler php5-cgi .php ############################################ ## GoDaddy specific options # Options -MultiViews ## you might also need to add this line to php.ini ## cgi.fix_pathinfo = 1 ## if it still doesn't work, rename php.ini to php5.ini ############################################ ## this line is specific for 1and1 hosting #AddType x-mapp-php5 .php #AddHandler x-mapp-php5 .php ############################################ ## default index file DirectoryIndex index.php <IfModule mod_php5.c> ############################################ ## adjust memory limit # php_value memory_limit 64M php_value memory_limit 128M php_value max_execution_time 18000 ############################################ ## disable magic quotes for php request vars php_flag magic_quotes_gpc off ############################################ ## disable automatic session start ## before autoload was initialized php_flag session.auto_start off ############################################ ## enable resulting html compression #php_flag zlib.output_compression on ########################################### # disable user agent verification to not break multiple image upload php_flag suhosin.session.cryptua off ########################################### # turn off compatibility with PHP4 when dealing with objects php_flag zend.ze1_compatibility_mode Off </IfModule> <IfModule mod_security.c> ########################################### # disable POST processing to not break multiple image upload SecFilterEngine Off SecFilterScanPOST Off </IfModule> <IfModule mod_deflate.c> ############################################ ## enable apache served files compression ## <a href="http://developer.yahoo.com/performance/rules.html#gzip" target="_blank">http://developer.yahoo.com/performance/rules.html#gzip</a> # Insert filter on all content ###SetOutputFilter DEFLATE # Insert filter on selected content types only #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # Netscape 4.x has some problems... #BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems #BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content #Header append Vary User-Agent env=!dont-vary </IfModule> <IfModule mod_ssl.c> ############################################ ## make HTTPS env vars available for CGI mode SSLOptions StdEnvVars </IfModule> <IfModule mod_rewrite.c> ############################################ ## enable rewrites Options +FollowSymLinks RewriteEngine on ############################################ ## you can put here your magento root folder ## path relative to web root #RewriteBase / ############################################ ## workaround for HTTP authorization ## in CGI environment RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] ############################################ ## always send 404 on missing files in these folders RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ ############################################ ## never rewrite for existing files, directories and links RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l ############################################ ## rewrite everything else to index.php RewriteRule .* index.php [L] </IfModule> ############################################ ## Prevent character encoding issues from server overrides ## If you still have problems, use the second line instead AddDefaultCharset Off #AddDefaultCharset UTF-8 <IfModule mod_expires.c> ############################################ ## Add default Expires header ## <a href="http://developer.yahoo.com/performance/rules.html#expires" target="_blank">http://developer.yahoo.com/performan...s.html#expires</a> ExpiresDefault "access plus 1 year" </IfModule> ############################################ ## By default allow all access Order allow,deny Allow from all ############################################ ## If running in cluster environment, uncomment this ## <a href="http://developer.yahoo.com/performance/rules.html#etags" target="_blank">http://developer.yahoo.com/performance/rules.html#etags</a> #FileETag none RewriteCond %{HTTP_HOST} ^(.*)alias-de-site.fr RewriteRule ^ - [E=MAGE_RUN_CODE:alias-de-site]
Le besoin est plus clair
Pour faire ça, il faut passer par les variables d'environnement : tu positionnes une certaine variable d'environnement avec SetEnvIf si le sous-domaine est celui attendu et tu mets un allow from env=... Faudra sûrement mettre aussi un Satisfy any. A tester car je ne sais pas comment ça fonctionne couplé à une authentification.
Merci _Mac_ & Developpez.com !!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 SetEnvIf Host nomdusite.fr passreq AuthType Basic AuthName "Merci de vous identifier..." AuthUserFile /var/www/vhosts/nomdusite.fr/httpdocs/.htpasswd AuthGroupFile / Require valid-user Order allow,deny Allow from all Deny from env=passreq Satisfy any
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager