Answer the question
In order to leave comments, you need to log in
How to make a beautiful link from a subdirectory?
Hello, you need to make the URL instead of site.ru/pages/news.php be site.ru/news
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
This should not be dealt with entirely by .htaccess, this should be done by the CNC to which .htaccess should already be transferred
. Only the kernel knows what kind of entity this page is, whether it is physical or not, and so on.
that is, the url can be prepared, but the second thing you will encounter is 404 because this page does not exist.
By this
URL prepares .htaccess and the kernel answers I have it.
Here is an example.
RewriteEngine On
#включает редиректы
RewriteCond %{REQUEST_FILENAME} !-f
# если это не файл
RewriteCond %{REQUEST_FILENAME} !-l
# и если это не линка
RewriteCond %{REQUEST_FILENAME} !-d
# и если это не директория
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
# И это не урл самого ЧПУ ( от цикла)
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
# Перенаправить все запросы на ЧПУ
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question