2011-01-14 10 views
0

Ich habe versucht, ein Modrewrite für meine Codeigniter-Site, aber wenn ich in die htaccess-Datei ging, gab es bereits eine.ModRewrite funktioniert nicht für Codeigniter-Site

RewriteEngine on 
RewriteCond $1 !^(index\.php?|combine\.php?|_images|assets|_styles|_js|favicon\.ico?|dashboard|mail) 
RewriteRule ^(.*)$ /index.php/$1 [L] 

Allerdings, wenn ich lokal testen meine Seite in XXAMP versuchen, ich habe index.php zu setzen, die alle meine Stil Links bricht. Gibt es etwas, das mir fehlt? Wenn die Site live ist, ist dies nicht erforderlich.

EDIT: Diese Website wurde auf MAMP auf OSX entwickelt, ich benutze XAMPP auf Windows, denke, dass könnte ein Teil des Problems sein?

+0

Ist modrewrite aktiviert? – Aif

+0

Ist dies eine Eigenschaft für Codeigniter oder PHP im Allgemeinen? – drpcken

+0

mod_rewrite ist ein Apache-Modul –

Antwort

2

In meinem CI-Projekt habe ich diese Daten in .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

Dies tat es! Vielen Dank! Das ist eine tolle Verwendung der Kommentare, denn ich hätte nie gedacht, was das alles getan hat. – drpcken

0

Sucht Apache nach der .htaccess-Datei? Vielleicht möchten Sie Ihre Konfiguration überprüfen.

+0

httpdc.conf sagt ein paar Dinge: 'AllowOverride All' und ' Auftrag erlauben, verweigern von allen Satisfy Deny All ' – drpcken

Verwandte Themen