[TYPO3] Redirect Question

Christian Vetter Christian.Vetter at dragoner-design.de
Fri Mar 24 12:00:19 CET 2006


Hi again,

Am 24.03.2006, 09:53 Uhr, schrieb Christoph Kiefer <kiefer at ifi.unizh.ch>:

> Christian
>
> Thanks for the quick help. Unfortunately, it didn't work your way :(
>
> Christian Vetter wrote:
>
>> 2/ To configure Apache, you'll need mod_rewrite (if using realurl,  
>> you'll
>> need it anyway). Your configuration should look like this:
>> [conf]
>>
>> RewriteEngine On
>> RewriteCond $0fileadmin/a/b/$1 -f
>
> This condition will never be true, since people will never pose a query
> string containing 'fileadmin' to the web server. They will just ask for
> http://www.example.org/page/file-in-b.txt. Or am I wrong here???
>

Indeed you are - you might want to read the  
documentation(http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html).
The Condition works on what is matched in the Rule that follows - that's  
right, the one that follows (for details and to learn why this is see the  
documentation *hint hint* ;) k, last time). That which is found by the  
parentheses in the RewriteRule is put into the variables $0,$1..$9 in the  
order they are found. Thus the following rule will, in conjunction with  
the preceding condition, put 'fileadmin/a/b/' in front of the string after  
the last '/' if - and this is where the condition comes to bear - that  
file exists.

>> RewriteRule (.*/)([^/]*) $0fileadmin/a/b/$1 -[L]
>
> Had no effect at all. I get a typo3 error:
>
> Error. Reason: Segment "a" was not a keyword for a postVarSet as  
> expected!

I don't really know what this error means - I've had it once or twice, but  
that's quite some time ago...
Anyways, this line's probably wrong (at least it's not good), change it to  
this:
RewriteRule ^(.*/)([^/]*)$ $0fileadmin/a/b/$1 [L]
Now the rewrite engine will only replace the request if it can match the  
whole request, whereas with my earlier proposition it would match if it  
found even a part in the request that would fit, probably causing you lots  
of trouble...
By the way, the '[L]' tells the rewrite engine to stop processing the  
request if it can find a match here.

With the line above replaced and the respective file placed inside  
[TYPO3]/fileadmin/a/b/ this should work as expected.

>
> Any ideas?

Matthew is right, as long as your server is configured to follow symlinks  
- it's probably easier than using mod_rewrite, but now you also have the  
code to do that so you have the freedom of choice :)

Best regards,
	Christian


>
> Regards
>
>   Christoph
>
>>
>> [/conf]
>
>>
>> Am 23.03.2006, 19:33 Uhr, schrieb Christoph Kiefer  
>> <kiefer at ifi.unizh.ch>:
>>
>>> Hi everybody,
>>>
>>> I have the following problem: let's say our typo3-webpage runs at
>>> 'http://www.example.org/page' and in the fileadmin-director of the
>>> typo3-installation I have created the folders 'a/b'
>>>
>>> So far so good. I want to access the files in 'b' in the following way:
>>>
>>> http://www.example.org/page/file-in-b.txt for instance and *not* like
>>> http://www.example.org/page/fileadmin/a/b/file-in-b.txt
>>>
>>> I know I need some kind of redirect mechanism here but cannot figure  
>>> out
>>>  which one.
>>>
>>> 1/ Is there a method without changing /httpd.conf/ and purely using
>>> typo3 or some extension???
>>>
>>> 2/ How would I eventually have to change /httpd.conf/?
>>>
>>> Any help would be very appreciated.
>>>
>>> Regards,
>>>
>>>    Christoph
>>> _______________________________________________
>>> TYPO3-english mailing list
>>> TYPO3-english at lists.netfielders.de
>>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english



More information about the TYPO3-english mailing list