Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Docs

Re: svn commit: r832217 - in /httpd/httpd/trunk/docs/manual/rewrite: index.html.en index.xml index.xml.tr remapping.html.en remapping.xml rewrite_guide.html.en rewrite_guide.xml

 

 

Apache docs RSS feed   Index | Next | Previous | View Threaded


bobsiegen at googlemail

Nov 3, 2009, 6:36 AM

Post #1 of 4 (72 views)
Permalink
Re: svn commit: r832217 - in /httpd/httpd/trunk/docs/manual/rewrite: index.html.en index.xml index.xml.tr remapping.html.en remapping.xml rewrite_guide.html.en rewrite_guide.xml

2009/11/3 <rbowen[at]apache.org>:
> Author: rbowen
> Date: Tue Nov 3 00:16:57 2009
> New Revision: 832217
>
> URL: http://svn.apache.org/viewvc?rev=832217&view=rev
> Log:
> Moves another rule out of rewrite_guide, and updates it for modern
> versions of mod_rewrite
>
> Modified:
> httpd/httpd/trunk/docs/manual/rewrite/index.html.en
> httpd/httpd/trunk/docs/manual/rewrite/index.xml
> httpd/httpd/trunk/docs/manual/rewrite/index.xml.tr
> httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en
> httpd/httpd/trunk/docs/manual/rewrite/remapping.xml
> httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en
> httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml
[...
]> +<div class="example"><pre>
> +# backward compatibility ruleset for
> +# rewriting document.html to document.php
> +# when and only when document.php exists
> +RewriteEngine on
> +
> +RewriteCond $1.php -f
> +RewriteCond $1.html !-f
> +RewriteRule ^(.*).html$ $1.php

I think this will lead to problems since $1 should contain (in per-dir
context) only local/foo and not /full/physical/path/to/local/foo as
required by apr_stat().

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org


rbowen at rcbowen

Nov 3, 2009, 8:41 AM

Post #2 of 4 (69 views)
Permalink
Re: svn commit: r832217 - in /httpd/httpd/trunk/docs/manual/rewrite: index.html.en index.xml index.xml.tr remapping.html.en remapping.xml rewrite_guide.html.en rewrite_guide.xml [In reply to]

On Nov 3, 2009, at 06:36 , Bob Ionescu wrote:

>>
>> +# backward compatibility ruleset for
>> +# rewriting document.html to document.php
>> +# when and only when document.php exists
>> +RewriteEngine on
>> +
>> +RewriteCond $1.php -f
>> +RewriteCond $1.html !-f
>> +RewriteRule ^(.*).html$ $1.php
>
> I think this will lead to problems since $1 should contain (in per-dir
> context) only local/foo and not /full/physical/path/to/local/foo as
> required by apr_stat().


Ah. We need a RewriteBase on there. Thanks.

--
Rich Bowen
rbowen[at]rcbowen.com




---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org


rbowen at rcbowen

Nov 4, 2009, 10:19 AM

Post #3 of 4 (66 views)
Permalink
Re: svn commit: r832217 - in /httpd/httpd/trunk/docs/manual/rewrite: index.html.en index.xml index.xml.tr remapping.html.en remapping.xml rewrite_guide.html.en rewrite_guide.xml [In reply to]

Will this fix it? :


@@ -177,11 +177,14 @@
# backward compatibility ruleset for
# rewriting document.html to document.php
# when and only when document.php exists
+&lt;Directory /var/www/htdocs&gt;
RewriteEngine on
+RewriteBase /var/www/htdocs

RewriteCond $1.php -f
RewriteCond $1.html !-f
-RewriteRule ^(.*).html$ $1.php
+RewriteRule ^(.*).html$ $1.php
+&lt;/Directory&gt;
</pre></example>
</dd>



On Nov 3, 2009, at 06:36 , Bob Ionescu wrote:

> 2009/11/3 <rbowen[at]apache.org>:
>> Author: rbowen
>> Date: Tue Nov 3 00:16:57 2009
>> New Revision: 832217
>>
>> URL: http://svn.apache.org/viewvc?rev=832217&view=rev
>> Log:
>> Moves another rule out of rewrite_guide, and updates it for modern
>> versions of mod_rewrite
>>
>> Modified:
>> httpd/httpd/trunk/docs/manual/rewrite/index.html.en
>> httpd/httpd/trunk/docs/manual/rewrite/index.xml
>> httpd/httpd/trunk/docs/manual/rewrite/index.xml.tr
>> httpd/httpd/trunk/docs/manual/rewrite/remapping.html.en
>> httpd/httpd/trunk/docs/manual/rewrite/remapping.xml
>> httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en
>> httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml
> [...
> ]> +<div class="example"><pre>
>> +# backward compatibility ruleset for
>> +# rewriting document.html to document.php
>> +# when and only when document.php exists
>> +RewriteEngine on
>> +
>> +RewriteCond $1.php -f
>> +RewriteCond $1.html !-f
>> +RewriteRule ^(.*).html$ $1.php
>
> I think this will lead to problems since $1 should contain (in per-dir
> context) only local/foo and not /full/physical/path/to/local/foo as
> required by apr_stat().
>
> Bob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
> For additional commands, e-mail: docs-help[at]httpd.apache.org
>

--
Rich Bowen
rbowen[at]rcbowen.com




---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org


covener at gmail

Nov 4, 2009, 11:00 AM

Post #4 of 4 (66 views)
Permalink
Re: svn commit: r832217 - in /httpd/httpd/trunk/docs/manual/rewrite: index.html.en index.xml index.xml.tr remapping.html.en remapping.xml rewrite_guide.html.en rewrite_guide.xml [In reply to]

On Wed, Nov 4, 2009 at 1:19 PM, Rich Bowen <rbowen[at]rcbowen.com> wrote:
> Will this fix it? :
>
>
> @@ -177,11 +177,14 @@
>  #   backward compatibility ruleset for
>  #   rewriting document.html to document.php
>  #   when and only when document.php exists
> +&lt;Directory /var/www/htdocs&gt;
>  RewriteEngine on
> +RewriteBase /var/www/htdocs
>
>  RewriteCond $1.php -f
>  RewriteCond $1.html !-f
> -RewriteRule ^(.*).html$ $1.php
> +RewriteRule ^(.*).html$ $1.php
> +&lt;/Directory&gt;
>  </pre></example>
>     </dd>

RewriteBase is the URL-path, not the filesystem path. And I don't
think test strings in a condition are expanded with respect to the
base.

You can figure out where the first pass landed by using
%{REQUEST_FILENAME} in per-dir context:

Alias /a /tmp/a
<directory /tmp/a>
RewriteBase /a
RewriteEngine on
# full path in per-directory contet
RewriteCond %{REQUEST_FILENAME} (.*)\.html$
RewriteCond %1.php -f
RewriteRule (.*)\.html$ $1.php
</directory>


--
Eric Covener
covener[at]gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe[at]httpd.apache.org
For additional commands, e-mail: docs-help[at]httpd.apache.org

Apache docs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.