Thread View: pl.comp.www.server-side
1 messages
1 total messages
Started by Peter May
Wed, 01 Dec 2010 11:03
Przekierowanie na index.php oraz innego katalogu
Author: Peter May
Date: Wed, 01 Dec 2010 11:03
Date: Wed, 01 Dec 2010 11:03
34 lines
1683 bytes
1683 bytes
Jest przykładowa struktura katalogów:
/a/
/b/
/abcd/
/c/
index.php
Chciałem wszystkie zapytania przekierować na index.php, oprócz tych,
które dotyczą katalogu /abcd/. Zrobiłem tak:
# Jesli request jest pusty to przekierowanie na index.php
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ index.php [NC,L]
# Jesli request zawiera /abcd/ to po prostu przekieruj na zadany plik w
katalogu /abcd/
RewriteCond %{REQUEST_URI} ^/abcd/.*$
RewriteRule ^(.*)$ /abcd/$1
# Reszta przechodzi przez index.php
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Coś jednak mi nie działa reguła dla /abcd/, bo na żądanie pliku z
katalogu /abcd/test/1.jpg dostaję błąd "404 Not Found".
Gdzie mam błąd?
--
Peter
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads