Ребята. Я использую кодигнитер. Я использовал .htaccess, чтобы удалить «index.php» из моего URL-адреса, и добавил «Разрешить от всех» в мой default.conf. 'index.php' был успешно удален, и сайт заработал. Но с момента последнего обновления apache .htacess перестал работать, и в URL-адресах стал необходим «index.php». Это мой новый обновленный 000-default.conf.
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
#vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Я добавил следующие строки в свой 000-default.conf, но это не сработало:
AllowOverride all
Order allow,deny
Allow from all
Мой .htaccess в порядке, потому что до последнего обновления Apache он работал нормально.
Options -Indexes
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{REQUEST_URI} ^htaccess/ [NC,OR]
RewriteCond %{REQUEST_URI} ^system/function/ [NC,OR]
#just make sure the last rule does NOT have an OR
RewriteCond %{REQUEST_URI} ^system/class/ [NC]
RewriteRule . - [R=404,L,NC]
Моя версия апача 2.4.6. Теперь, пожалуйста, скажите мне, что добавить в 000-default.conf, чтобы заставить работать .htaccess и удалить «index.php» из URL-адреса моего сайта.
P.S. Я использую Ubuntu 12.04. mod_rewrite включен. Я включил 000-default.conf, т. е. он доступен в моей папке с поддержкой сайтов.