Я создал новый файл .htaccess и смею сказать, что мой код перезаписи правильный. Но это не работает, вместо этого мои
запросы, похоже, передаются на index.php без добавления параметров запроса. Это поведение одинаково, независимо от того, отключаю ли я правила .htaccess или нет.
Код: Выделить всё
RewriteEngine On
# /ID to index.php?id=ID
RewriteRule ^([0-9a-k]{1,12})$ index.php?id=$1 [L]
# /ID/FILENAME.EXT to contents.php?id=ID&name=FILENAME.EXT
RewriteRule ^([0-9a-k]{1,12})/([^/&?]+)$ contents.php?id=$1&name=$2 [L]
< /code>
Test results:
/abcxyz -> index.php
/abc/xyz -> index.php
/abc.html -> 404
/abc.xyz -> 404
/abc. -> 404
/abc?id=123 -> index.php?id=123
/abc.xyz?id=123 -> 404
< /code>
I think maybe the PHP motor behind repl doesn't use or support .htacess files. But I can't find any documentation on .htaccess use or anything related to rewriting.
The Replit documentation is very sparse and when choosing "I need help with how to use Replit" they redirect to Stack Overflow! Here I am...
My needs are:
[list]
[*]Rewrite ^([0-9a-k]{1,12})$[*] rewrite ^([0-9a-k] {1,12})/([ ^/& ?]+) $ to contents.php? id = $ 1 & filename = 2 $ .
[/list]
Первый я, вероятно, могу С помощью URL -адреса запроса на чтение с index.php или что -то в этом роде? Второй должен поддерживать пути с расширениями файлов, и это не кажется возможным с функциональностью, которую я нашел из моего тестирования.
Подробнее здесь: https://stackoverflow.com/questions/793 ... replit-php
Мобильная версия