You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Charles Heizer <he...@llnl.gov> on 2004/10/06 19:12:41 UTC

[users@httpd] mod_rewrite help ...

Hello,
I'm try to do a rewrite rule and I don't know if it's possible. I have 
a virtual host that that redirects all port 80 traffic to https and 
this works fine ...

<VirtualHost *:80>
         # Redirect all traffic from http to https
         RewriteEngine on
         RewriteLogLevel 1
         RewriteLog /opt/apache2/logs/wservant_rewite_log
         RewriteRule ^/(.*)  https://www.foo.com/$1   [L,R]
         DocumentRoot /www/foo
</VirtualHost>

What I'm trying to do now and can't seem to get is, I want to rewite 
all traffic except for any file that ends in .xml. So if there is a 
incoming request for http://www.foo.com/args.xml it won't redirect it 
to https://www.foo.com/args.xml.


Thanks, I hope this makes sense.

- Charles Heizer


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite help ...

Posted by Joshua Slive <js...@gmail.com>.
On Wed, 6 Oct 2004 10:12:41 -0700, Charles Heizer <he...@llnl.gov> wrote:
> Hello,
> I'm try to do a rewrite rule and I don't know if it's possible. I have
> a virtual host that that redirects all port 80 traffic to https and
> this works fine ...
> 
> <VirtualHost *:80>
>          # Redirect all traffic from http to https
>          RewriteEngine on
>          RewriteLogLevel 1
>          RewriteLog /opt/apache2/logs/wservant_rewite_log
>          RewriteRule ^/(.*)  https://www.foo.com/$1   [L,R]
>          DocumentRoot /www/foo
> </VirtualHost>
> 
> What I'm trying to do now and can't seem to get is, I want to rewite
> all traffic except for any file that ends in .xml. So if there is a
> incoming request for http://www.foo.com/args.xml it won't redirect it
> to https://www.foo.com/args.xml.

Any file that ends in xml or only that specific file?

If the former, use
RewriteCond %{REQUEST_URI} !.*\.xml$
and if the latter, use
RewriteCond %{REQUEST_URI} !^/args\.xml$


Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org