Aller au contenu

« Htaccess » : différence entre les versions

De Marmits Wiki
Aucun résumé des modifications
Aucun résumé des modifications
 
Ligne 1 : Ligne 1 :
== rediriger un sous-dossiers d'un domaine vers un sous domaine ==
== rediriger un sous-dossiers d'un domaine vers un sous domaine ==
exemple.com/test -> test.exemple.com
exemple.com/test -> test.exemple.com
 
<syntaxhighlight lang="apache" line>
  RewriteEngine on
  RewriteEngine on
  RewriteCond %{REQUEST_URI} /(.+)/
  RewriteCond %{REQUEST_URI} /(.+)/
  RewriteRule .* http://%1.exemple.com
  RewriteRule .* http://%1.exemple.com
 
</syntaxhighlight>


== Protection répertoire ==
== Protection répertoire ==
Créer un htpasswd dans un répertoire "protect"
Créer un htpasswd dans un répertoire "protect"
<pre>
<syntaxhighlight lang="apache" line>
htpasswd -c .htpasswd geo -> en mode basic  
htpasswd -c .htpasswd geo -> en mode basic  
htdigest -c .htpasswdprivatphp "PRIVATPHP" geo -> en mode digest  
htdigest -c .htpasswdprivatphp "PRIVATPHP" geo -> en mode digest  
</pre>
</syntaxhighlight>
 
[[category:Linux]] [[category:Apache]] [[category:Dev]]
[[category:Linux]] [[category:Apache]] [[category:Dev]]

Dernière version du 23 février 2025 à 16:29

rediriger un sous-dossiers d'un domaine vers un sous domaine

exemple.com/test -> test.exemple.com

 RewriteEngine on
 RewriteCond %{REQUEST_URI} /(.+)/
 RewriteRule .* http://%1.exemple.com

Protection répertoire

Créer un htpasswd dans un répertoire "protect"

htpasswd -c .htpasswd geo -> en mode basic 
htdigest -c .htpasswdprivatphp "PRIVATPHP" geo -> en mode digest