You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by vi...@outblaze.com on 2002/07/03 04:02:45 UTC

Re: Mod_rewrite problem.

what happen if you take out that rewrite rule?  will your image file get
served properly?

indeed, from the log you provided, it suggest the rewrite is working as
you expected, it didn't do anything to you uri /test.gif

Tor.


Ross wrote:
> 
> Hi all
> 
> I'm tearing my hair out over a mod_rewrite problem. I'm installing an
> application called eZPublish (ez.no). It has several rewrite rules but
> I have it down to one line to illustrate my problem.
> 
> RewriteEngine On
> RewriteLog /home/web/log/rewrite_log
> RewriteLogLevel 9
> RewriteRule !\.(gif|css|jpg|png|jar)$ /mypath/index.php
> 
> Everything should go to index.php except images which should be
> unchanged. I'm testing this with two files, index.php and test.gif
> 
> Any non-image request correctly returns index.php but image requests
> produce nothing at all from the server. Zero bytes are returned.
> 
> I'm using a virtual server account which gives me almost full control.
> Apache/1.3.23.
> 
> Thanks for any help.
> 
> Cheers
> Ross
> 
> Here is the log:
> 
> (2) init rewrite engine with requested uri /test.html
> (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.html'
> (2) rewrite /test.html -> /home/httpd/docs/ez/index.php(2) local path
> result: /mypath/index.php
> (1) go-ahead with /home/httpd/docs/ez/index.php [OK]
> (2) init rewrite engine with requested uri /test.gif
> (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> (2) init rewrite engine with requested uri /test.gif
> (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> (2) init rewrite engine with requested uri /test.gif
> (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> 
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_rewrite problem.

Posted by Ross <te...@yahoo.com>.
--- Robert Andersson <ro...@profundis.nu> wrote:
> Ross wrote:
> > --- victor@outblaze.com wrote:
> > > and.. don't know if this help, but how about breaking the rule
> into a
> > > cond and a rule I mean..
> > >
> > > RewriteCond .* !\.(gif|css|jpg|png|jar)$
> > > RewriteRule .* /mypath/index.php
> 
> I haven't used regex much in Apache, but doesn't the negator only
> effect the
> dot (\.) here?. Wouldn't it be better to have something like:
> 
> RewriteCond.* !(\.gif|\.css|\.jpg|\.png|\.jar)$
> ...or...
> RewriteCond.* !(\.(gif|css|jpg|png|jar))$
> 
> Just a thought

Thanks but I've tried this sort of thing.

Its not that the rule is making the wrong decision, its the fact that a
uri that falls through then causes the server to produce nothing.

Does anything know why a working Apache server would return absolutely
nothing for a request?

Cheers
Ross


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_rewrite problem.

Posted by Robert Andersson <ro...@profundis.nu>.
Ross wrote:
> --- victor@outblaze.com wrote:
> > and.. don't know if this help, but how about breaking the rule into a
> > cond and a rule I mean..
> >
> > RewriteCond .* !\.(gif|css|jpg|png|jar)$
> > RewriteRule .* /mypath/index.php

I haven't used regex much in Apache, but doesn't the negator only effect the
dot (\.) here?. Wouldn't it be better to have something like:

RewriteCond.* !(\.gif|\.css|\.jpg|\.png|\.jar)$
...or...
RewriteCond.* !(\.(gif|css|jpg|png|jar))$

Just a thought

Regards,
Robert Andersson




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_rewrite problem.

Posted by vi...@outblaze.com.
> 
> > and.. don't know if this help, but how about breaking the rule into a
> > cond and a rule I mean..
> >
> > RewriteCond   .*      !\.(gif|css|jpg|png|jar)$
> > RewriteRule   .*      /mypath/index.php


  oh.. I'm sorry, my mistake, the RewriteCond should be

RewriteCond	%{REQUEST_URI}	!\.(gif|css|jpg|png|jar)$


 
> I tried that and now nothing is served at all, not even the non-image
> requests which previously worked. Its just like the server is not
> working at all but it is because I can happily access other virtual
> hosts on it.
> 
> Thanks for your suggestions. I've just about given up on this.

  oh.. too bad.. :<

Tor.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_rewrite problem.

Posted by Ross <te...@yahoo.com>.
--- victor@outblaze.com wrote:
> mu.. is there any other rule after the one you have attached?

No.

> and.. don't know if this help, but how about breaking the rule into a
> cond and a rule I mean..
> 
> RewriteCond	.*	!\.(gif|css|jpg|png|jar)$
> RewriteRule	.*	/mypath/index.php

I tried that and now nothing is served at all, not even the non-image
requests which previously worked. Its just like the server is not
working at all but it is because I can happily access other virtual
hosts on it.

Thanks for your suggestions. I've just about given up on this.

Cheers
Ross


> Ross wrote:
> > 
> > --- victor@outblaze.com wrote:
> > > what happen if you take out that rewrite rule?  will your image
> file
> > > get
> > > served properly?
> > 
> > Yes, if I either set rewrite off, or leave it on and comment out
> that
> > line, my image is served normally. If I remove the gif from the
> rule
> > then test.gif gets index.php as expected.
> > 
> > > indeed, from the log you provided, it suggest the rewrite is
> working
> > > as
> > > you expected, it didn't do anything to you uri /test.gif
> > 
> > Yes, very strange.
> > 
> > Ross
> > 
> > > Ross wrote:
> > > >
> > > > Hi all
> > > >
> > > > I'm tearing my hair out over a mod_rewrite problem. I'm
> installing
> > > an
> > > > application called eZPublish (ez.no). It has several rewrite
> rules
> > > but
> > > > I have it down to one line to illustrate my problem.
> > > >
> > > > RewriteEngine On
> > > > RewriteLog /home/web/log/rewrite_log
> > > > RewriteLogLevel 9
> > > > RewriteRule !\.(gif|css|jpg|png|jar)$ /mypath/index.php
> > > >
> > > > Everything should go to index.php except images which should be
> > > > unchanged. I'm testing this with two files, index.php and
> test.gif
> > > >
> > > > Any non-image request correctly returns index.php but image
> > > requests
> > > > produce nothing at all from the server. Zero bytes are
> returned.
> > > >
> > > > I'm using a virtual server account which gives me almost full
> > > control.
> > > > Apache/1.3.23.
> > > >
> > > > Thanks for any help.
> > > >
> > > > Cheers
> > > > Ross
> > > >
> > > > Here is the log:
> > > >
> > > > (2) init rewrite engine with requested uri /test.html
> > > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri
> '/test.html'
> > > > (2) rewrite /test.html -> /home/httpd/docs/ez/index.php(2)
> local
> > > path
> > > > result: /mypath/index.php
> > > > (1) go-ahead with /home/httpd/docs/ez/index.php [OK]
> > > > (2) init rewrite engine with requested uri /test.gif
> > > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri
> '/test.gif'
> > > > (2) init rewrite engine with requested uri /test.gif
> > > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri
> '/test.gif'
> > > > (2) init rewrite engine with requested uri /test.gif
> > > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri
> '/test.gif'
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Sign up for SBC Yahoo! Dial - First Month Free
> > > > http://sbc.yahoo.com
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> > >
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Sign up for SBC Yahoo! Dial - First Month Free
> > http://sbc.yahoo.com


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_rewrite problem.

Posted by vi...@outblaze.com.
mu.. is there any other rule after the one you have attached?

and.. don't know if this help, but how about breaking the rule into a
cond and a rule I mean..

RewriteCond	.*	!\.(gif|css|jpg|png|jar)$
RewriteRule	.*	/mypath/index.php

Tor.


Ross wrote:
> 
> --- victor@outblaze.com wrote:
> > what happen if you take out that rewrite rule?  will your image file
> > get
> > served properly?
> 
> Yes, if I either set rewrite off, or leave it on and comment out that
> line, my image is served normally. If I remove the gif from the rule
> then test.gif gets index.php as expected.
> 
> > indeed, from the log you provided, it suggest the rewrite is working
> > as
> > you expected, it didn't do anything to you uri /test.gif
> 
> Yes, very strange.
> 
> Ross
> 
> > Ross wrote:
> > >
> > > Hi all
> > >
> > > I'm tearing my hair out over a mod_rewrite problem. I'm installing
> > an
> > > application called eZPublish (ez.no). It has several rewrite rules
> > but
> > > I have it down to one line to illustrate my problem.
> > >
> > > RewriteEngine On
> > > RewriteLog /home/web/log/rewrite_log
> > > RewriteLogLevel 9
> > > RewriteRule !\.(gif|css|jpg|png|jar)$ /mypath/index.php
> > >
> > > Everything should go to index.php except images which should be
> > > unchanged. I'm testing this with two files, index.php and test.gif
> > >
> > > Any non-image request correctly returns index.php but image
> > requests
> > > produce nothing at all from the server. Zero bytes are returned.
> > >
> > > I'm using a virtual server account which gives me almost full
> > control.
> > > Apache/1.3.23.
> > >
> > > Thanks for any help.
> > >
> > > Cheers
> > > Ross
> > >
> > > Here is the log:
> > >
> > > (2) init rewrite engine with requested uri /test.html
> > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.html'
> > > (2) rewrite /test.html -> /home/httpd/docs/ez/index.php(2) local
> > path
> > > result: /mypath/index.php
> > > (1) go-ahead with /home/httpd/docs/ez/index.php [OK]
> > > (2) init rewrite engine with requested uri /test.gif
> > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> > > (2) init rewrite engine with requested uri /test.gif
> > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> > > (2) init rewrite engine with requested uri /test.gif
> > > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Sign up for SBC Yahoo! Dial - First Month Free
> > > http://sbc.yahoo.com
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> 
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Mod_rewrite problem.

Posted by Ross <te...@yahoo.com>.
--- victor@outblaze.com wrote:
> what happen if you take out that rewrite rule?  will your image file
> get
> served properly?

Yes, if I either set rewrite off, or leave it on and comment out that
line, my image is served normally. If I remove the gif from the rule
then test.gif gets index.php as expected.

> indeed, from the log you provided, it suggest the rewrite is working
> as
> you expected, it didn't do anything to you uri /test.gif

Yes, very strange.

Ross


> Ross wrote:
> > 
> > Hi all
> > 
> > I'm tearing my hair out over a mod_rewrite problem. I'm installing
> an
> > application called eZPublish (ez.no). It has several rewrite rules
> but
> > I have it down to one line to illustrate my problem.
> > 
> > RewriteEngine On
> > RewriteLog /home/web/log/rewrite_log
> > RewriteLogLevel 9
> > RewriteRule !\.(gif|css|jpg|png|jar)$ /mypath/index.php
> > 
> > Everything should go to index.php except images which should be
> > unchanged. I'm testing this with two files, index.php and test.gif
> > 
> > Any non-image request correctly returns index.php but image
> requests
> > produce nothing at all from the server. Zero bytes are returned.
> > 
> > I'm using a virtual server account which gives me almost full
> control.
> > Apache/1.3.23.
> > 
> > Thanks for any help.
> > 
> > Cheers
> > Ross
> > 
> > Here is the log:
> > 
> > (2) init rewrite engine with requested uri /test.html
> > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.html'
> > (2) rewrite /test.html -> /home/httpd/docs/ez/index.php(2) local
> path
> > result: /mypath/index.php
> > (1) go-ahead with /home/httpd/docs/ez/index.php [OK]
> > (2) init rewrite engine with requested uri /test.gif
> > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> > (2) init rewrite engine with requested uri /test.gif
> > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> > (2) init rewrite engine with requested uri /test.gif
> > (3) applying pattern '\.(gif|css|jpg|png|jar)$' to uri '/test.gif'
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Sign up for SBC Yahoo! Dial - First Month Free
> > http://sbc.yahoo.com
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org