Tôi đang sử dụng CodeIgniter và vừa cài đặt LAMP stack trên máy chủ đám mây Ubuntu 10.10..htaccess không hoạt động mặc dù cho phép ghi đè được bật
Mọi thứ đang hoạt động tốt và tôi đã bật mô-đun userdir Apache để thư mục chính của tôi nằm ở số /home/myapp/public_html
và tôi truy cập vào bằng cách truy cập servername/~myapp
.
Không may, .htaccess
ghi đè dường như không hoạt động - gây ra 404 nói the file /home/myapp/public_html/index.php
không thể tìm thấy - lỗi 404.
Mod_rewrite được bật.
Tôi biết rằng bạn cần đặt chỉ thị AllowOverride All
- Tôi đã đặt chỉ số /etc/apache2/sites-enabled/default
- nhưng viết lại dường như không hoạt động đúng cách.
tập tin .htaccess
tôi chỉ đơn giản bao gồm:
RewriteEngine on
RewriteCond $1 !^(index.php|img|stylesheets|js|icons|robots\.txt|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]
Và /etc/apache2/sites-available/default
của tôi trông giống như:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride ALL
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
Và cuối cùng, /etc/apache2/mods-enabled/userdir.conf
trông giống như:
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
Tôi đã googling và không quan tâm hàng giờ, có ai giúp được không?
Điều này cũng có tác dụng đối với tôi .... Sử dụng laravel với Ubuntu 10.10 có cùng vấn đề ... – ftrotter
Sự cố này cũng xảy ra đối với tôi trên ubu 12.04LTS, nó hoạt động !, chúng tôi có thứ gì đó giống như stackoverflow! – Mazzy
Tôi rất vui được giúp :) – jonas