PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > Problem with Apache MultiViews and Rewriting
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

Problem with Apache MultiViews and Rewriting

Réponse
 
LinkBack Outils de la discussion
Vieux 10/10/2006, 23h22   #1
Johann Gile
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Problem with Apache MultiViews and Rewriting

Hello,

I have a problem with MultiViews and rewriting, after a change in the
file naming scheme I would like to enforce a certain clean URL form
without filename extensions in the form of /foo, /bar or /bar.en or
/bar.de instead of foo.html, bar.en.html, bar.de.html. To be precise I
want the following external redirects:

foo.html -> /foo
bar.html -> /bar (and then content negotiation should determine if the
de or en variant is delivered)

For bar.html this can be solved by

RewriteCond %{REQUEST_FILENAME} !\.(de|en)\.html$
RewriteRule ^(.+)\.html$ /$1 [R=301,L]

However this creates an infinite redirect loop for foo.html, it matches
the RewriteCond, is turned from foo.html into /foo, then Multiviews
makes that foo.html again and the rewrite starts all over infinitely.

How can I stop that? I cannot just turn off MultiViews since I need it
for /bar.

Thanks for any .

Regards,

Johann

  Réponse avec citation
Vieux 11/10/2006, 09h38   #2
Nick Kew
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with Apache MultiViews and Rewriting

iN ARTICLE <1160518963.572660.204740@i42g2000cwa.googlegroups .com>,
"Johann Gile" <jgile_linux@yahoo.de> writes:
> Hello,
>
> I have a problem with MultiViews and rewriting, after a change in the
> file naming scheme I would like to enforce a certain clean URL form
> without filename extensions in the form of /foo, /bar or /bar.en or
> /bar.de instead of foo.html, bar.en.html, bar.de.html. To be precise I
> want the following external redirects:
>
> foo.html -> /foo
> bar.html -> /bar (and then content negotiation should determine if the
> de or en variant is delivered)


Forget mod_rewrite. mod_negotiation will select the right variant for
you, regardless of whether the ".html" appears in the URLs.
See the documentation, and also the (multilingual) Apache manual itself.

--
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.prenhallprofessional.com/title/0132409674
  Réponse avec citation
Vieux 11/10/2006, 11h19   #3
Johann Gile
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem with Apache MultiViews and Rewriting

Nick Kew schrieb:

> iN ARTICLE <1160518963.572660.204740@i42g2000cwa.googlegroups .com>,
> "Johann Gile" <jgile_linux@yahoo.de> writes:
> > /bar.de instead of foo.html, bar.en.html, bar.de.html. To be precise I
> > want the following external redirects:
> >
> > foo.html -> /foo
> > bar.html -> /bar (and then content negotiation should determine if the
> > de or en variant is delivered)

>
> Forget mod_rewrite. mod_negotiation will select the right variant for
> you, regardless of whether the ".html" appears in the URLs.


well, this already works and is not the issue. However I want URLs with
a ".html" to be redirected with a 301 code as shown above. I just can't
get it to work without an infinite redirect loop beacuse of MultiViews.

  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 11h45.


É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,11914 seconds with 11 queries