PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > comp.info.servers.unix > canonical hostnames apache2 in .htaccess
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.info.servers.unix Web servers for UNIX platforms.

canonical hostnames apache2 in .htaccess

Réponse
 
LinkBack Outils de la discussion
Vieux 09/03/2005, 18h49   #1
Mark
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut canonical hostnames apache2 in .htaccess

I tried this also in the virtual host section but I do not want to make
it more difficult so I moved it into the .htaccess file.

Problem:
I have two domains www.mark-fink.de and www.mark-fink.com. Now I want to
enforce the use of www.mark-fink.de all others (mark-fink.com ...)
should be directed to this url. I set the aliases in the virtual host I
use section (file since I use debian sarge).

the .htaccess file looks like this:
# Force usage of www.mark-fink.de
RewriteCond %{HTTP_HOST} !^www\.mark-fink\.de [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.mark-fink.de/$1 [L,R]

# enable url rewriting for Typo3 RealURL extension
RewriteEngine On
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php

(the typo3 realurl works fine)
I configured the cannonical hostname section according to the apache
manual for version 1. Is something discontinued or altered?

Any ideas?

Regards,
Mark
  Réponse avec citation
Vieux 10/03/2005, 12h04   #2
Tim
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: canonical hostnames apache2 in .htaccess

On Wed, 09 Mar 2005 19:49:27 +0100,
Mark <mark_fink@web.de> posted:

> I tried this also in the virtual host section but I do not want to make
> it more difficult so I moved it into the .htaccess file.


So long as you're aware that some things can't be done in .htaccess files,
though this doesn't seem to be one of them.

> Problem:
> I have two domains www.mark-fink.de and www.mark-fink.com. Now I want to
> enforce the use of www.mark-fink.de all others (mark-fink.com ...)
> should be directed to this url. I set the aliases in the virtual host I
> use section (file since I use debian sarge).
>
> the .htaccess file looks like this:
> # Force usage of www.mark-fink.de
> RewriteCond %{HTTP_HOST} !^www\.mark-fink\.de [NC]
> RewriteCond %{HTTP_HOST} !^$
> RewriteRule ^/(.*) http://www.mark-fink.de/$1 [L,R]


The example I followed looked like this, and that sort of thing does work
for me:

RewriteCond %{HTTP_HOST} ^mark-fink.de$ [NC]
RewriteRule ^(.*)$ http://www.mark-fink.de/$1 [R=301,L]

I haven't tried it with the !^www\, not variation, but you can.

Note the "R=301", that makes the redirect a permanent redirect, rather than
a temporary one. i.e. All future references should use the new URI, and
bookmarks and databases using the old ones should be updated.

Without that, things like search engines will continue to use the URI that
you don't want them to.

Should your RewriteEngine on directive be nearer the top of the .htaccess
file?

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please delete some files yourself.
  Réponse avec citation
Vieux 10/03/2005, 16h55   #3
Mark
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: canonical hostnames apache2 in .htaccess

Hi Tim!

Works now. Absolutely great support. Many thanks.

Cheers,
Mark
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h57.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10698 seconds with 11 queries