Problem with Apache MultiViews and Rewriting

This is a discussion on Problem with Apache MultiViews and Rewriting within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello, I have a problem with MultiViews and rewriting, after a change in the file naming scheme I would like ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-10-2006
Johann Gile
 
Posts: n/a
Default 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 help.

Regards,

Johann

  #2 (permalink)  
Old 10-11-2006
Nick Kew
 
Posts: n/a
Default 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
  #3 (permalink)  
Old 10-11-2006
Johann Gile
 
Posts: n/a
Default 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.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:06 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0