我很难让mod_rewrite使用 CodeIgniter。我正在运行 apache 2.4。
我的网络根目录是/Users/Jason/Development/www
这是我目前在 .htaccess 文件中的代码,该文件与我的主索引.php文件位于同一目录中。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myapp/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
我做错了什么?我不断收到一个 404 页面,说在此服务器上找不到请求的 URL。
Options -Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /
# exclude any paths that are not codeigniter-app related
RewriteCond %{REQUEST_URI} !^/server-status
RewriteCond %{REQUEST_URI} !^/server-info
RewriteCond %{REQUEST_URI} !^/docs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
# the following is for rewritting under FastCGI
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
基于乙状结肠 https://www.npcglib.org/~stathis/blog/2013/08/12/apache-tip-rewriting-urls-with-apache-2-4-php-fpm-mod_fastcgi_handler-codeigniter/