我为我的codeigniter网站尝试了一个modrewrite,但是当我进入htaccess文件时,已经有了一个。
RewriteEngine on
RewriteCond $1 !^(index\.php?|combine\.php?|_images|assets|_styles|_js|favicon\.ico?|dashboard|mail)
RewriteRule ^(.*)$ /index.php/$1 [L]
然而,当我尝试在xxamp中本地测试我的网站时,我必须放置index.php
,这会破坏我所有的样式链接。有什么我想念的吗?当网站上线时,不需要。
答案 0 :(得分:2)
在我的CI项目中,我在.htaccess中有这些数据
RewriteEngine On RewriteBase / #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application folder isn't in the system folder #This snippet prevents user access to the application folder #Submitted by: Fabdrol #Rename 'application' to your applications folder name. RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]
答案 1 :(得分:0)
apache是否正在寻找.htaccess文件?您可能需要检查配置。