首先,我不是Linux,甚至是Apache的专家,我习惯在Windows上工作,WAMP,你恰好在图标上点击并更改你想要改变的配置。
现在我让LAMP正常工作,唯一不起作用的是HTACCESS
重写:
Options -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
这是一个常见的HTACCESS设置。
每次我写URL:localhost/mysite/services
它会抛出404错误。
您必须知道我已经尝试过在Stackoverflow和Ubuntu论坛中看到的所有内容。
1)当我检查mod重写是否处于活动状态时,它表示它是2)我在"default.conf"
中创建了一个"/etc/apache2/sites-available"
文件并将其放入:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
3)之后我重新启动了apache2服务
似乎什么都没有用,我很绝望,因为我必须在明天完成这项工作。
编辑:
这个确切的配置工作在Windows-WAMP和Production Server(hostgator)...我只是将所有应用程序粘贴到我的Ubuntu笔记本电脑上,在这里,它无法正常工作。
我在Ubuntu 14中使用apache2,这对我来说很好。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|public|hme|img|editor|tsd|wd|images|edi|js|fonts|assets|robots\.txt|css|blog)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
希望这可以帮助。