Ниже показан код .htaccess для генерации SEF-url, когда joomla SEF включен в бэкэнд..htaccess перенаправление index.php
## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
У меня есть простая проблема, с которой я не могу окунуться. Я положил это условие так, чтобы, если URL-адрес domain.com/index.php, он должен перейти на домен.com, и это должно произойти только в том случае, если шаблон совпадает именно с index.php. Однако это происходит для всех URL-адресов.
RewriteCond %{THE_REQUEST} [^.]*|/(index.php)$
RewriteRule ^index.php$/[R=301,L]
вы можете сказать мне, почему вы не использовали $ в конце RewriteCond, поскольку $ означает конец строки, не так ли? –
Спасибо за это. В основном он делает то, что я хочу сделать. Однако это также влияет на папку администратора joomla и не позволяет мне войти в систему. Сохраняет перенаправление на экран входа в систему. Могу ли я как-то предотвратить это. –
да, это можно сделать, см. Править выше. – anubhava