You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Thomas Schweikle <tp...@vr-web.de> on 2007/11/22 10:10:22 UTC

[users@httpd] redirects

Hi!

I have configured apache2:

ScriptAlias /mirrorlist "/usr/share/mirrorlist/mirrorlist"
<Directory "/usr/share/mirrorlist">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from 172.16.0.0/16
    Allow from 192.168.0.0/16
</Directory>

RewriteEngine on
RewriteRule "^/?(.*)$"  "/mirrorlist?$1"

But this only leads to

401 Not Found
The requested URL / was not found on this server.

using an url of "http://server/mirrorlist?parameter=something" or
"http://server/?parameter=something".

If I remove rewriting,
"http://server/mirrorlist?parameter=something" works, while
"http://server/?parameter=someting" does, as expected, not.

Any idea what I am doing wrong?


-- 
Thomas


---------------------------------------------------------------------
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


[users@httpd] Re: redirects

Posted by Thomas Schweikle <tp...@vr-web.de>.
Joshua Slive schrieb:
> On Nov 22, 2007 4:10 AM, Thomas Schweikle <tp...@vr-web.de> wrote:
>> Hi!
>>
>> I have configured apache2:
>>
>> ScriptAlias /mirrorlist "/usr/share/mirrorlist/mirrorlist"
>> <Directory "/usr/share/mirrorlist">
>>     Options None
>>     AllowOverride None
>>     Order allow,deny
>>     Allow from 172.16.0.0/16
>>     Allow from 192.168.0.0/16
>> </Directory>
>>
>> RewriteEngine on
>> RewriteRule "^/?(.*)$"  "/mirrorlist?$1"
> 
> You would need the [PT] flag on the RewriteRule to ask that the
> ScriptAlias be applied to the result. But why not just replace the
> ScriptAlias with
> ScriptAlias / /usr/share/mirrorlist/mirrorlist
> or
> ScriptAliasMatch ^/$ /usr/share/mirrorlist/mirrorlist
> (depending on what you are looking for. Your RewriteRule is not at all
> clear, since RewriteRules do not match the query string (the part
> after the ?).)

Thanks! It is working now as expected. I used the second form. It
allows matching "/" only and keeping other services working.


-- 
Thomas


---------------------------------------------------------------------
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] redirects

Posted by Joshua Slive <jo...@slive.ca>.
On Nov 22, 2007 4:10 AM, Thomas Schweikle <tp...@vr-web.de> wrote:
> Hi!
>
> I have configured apache2:
>
> ScriptAlias /mirrorlist "/usr/share/mirrorlist/mirrorlist"
> <Directory "/usr/share/mirrorlist">
>     Options None
>     AllowOverride None
>     Order allow,deny
>     Allow from 172.16.0.0/16
>     Allow from 192.168.0.0/16
> </Directory>
>
> RewriteEngine on
> RewriteRule "^/?(.*)$"  "/mirrorlist?$1"

You would need the [PT] flag on the RewriteRule to ask that the
ScriptAlias be applied to the result. But why not just replace the
ScriptAlias with
ScriptAlias / /usr/share/mirrorlist/mirrorlist
or
ScriptAliasMatch ^/$ /usr/share/mirrorlist/mirrorlist
(depending on what you are looking for. Your RewriteRule is not at all
clear, since RewriteRules do not match the query string (the part
after the ?).)

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