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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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. |