我的codeigniter库位于名为' codeigniter'的文件夹下。 (非常原创)所以我在这个地址访问它,加载正常,http://mysite.co.uk/codeigniter/index.php/pages/view/about
但是我无法接触到我的关于'页面使用以下地址http://mysite.co.uk/codeigniter/pages/view/about网址,而不包含' index.php'在地址中,它不断触及我的默认控制器而不是我的页面控制器。
我已更新以下内容:
的config.php
$config['base_url'] = 'http://mysite';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
的.htaccess
RewriteEngine on
RewriteBase /codeigniter/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
任何帮助都会很棒!
答案 0 :(得分:0)
确保将“AllowOverride All”放在Apache配置文件中,以便.htaccess可以使用。
答案 1 :(得分:0)
您可以在.htaccess
中使用此功能RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
答案 2 :(得分:0)
您可以在.htaccess文件中使用它
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
#RewriteRule \.(jpe?g|gif|bmp|png)$ - [F]
</IfModule>
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
<IfModule mod_headers.c>
Header add Cache-Control: "no-store, no-cache, must-revalidate"
Header unset Pragma
FileETag None
Header unset ETag
</IfModule>
#End Gzip
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>