CodeIgniter URL nicht gefunden
enter code here
Ich habe diesen code in meine .htaccess-Datei:
RewriteEngine On
RewriteBase /projFolder
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(mycontrol(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]
# Enforce www
# If you have subdomains, you can add them to
# the list using the "|" (OR) regex operator
RewriteCond %{HTTP_HOST} !^(www|subdomain) [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
# Enforce NO www
#RewriteCond %{HTTP_HOST} ^www [NC]
#RewriteRule ^(.*)$ http://domain.tld/$1 [L,R=301]
###
# 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]
# 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]
Mein Projekt ist in /var/www/projFolder -> die Struktur in diesem Ordner ist
/application
/system
/user_guide
.htaccess
index.php
änderte ich $route['default_controller'] = "mycontrol"; in der config routes.php Datei.
wenn ich die url localhost/projFolder/es laden Sie die Standard-mycontrol.php controller und die index-Funktion von diesem controller. Wenn ich dann localhost/projFolder/myFunction -> was bedeutet, dass ich laden will myFunction aus der Standard-controller es gibt mir "Die angeforderte URL wurde nicht auf diesem server." Kann jemand helfen? Danke.
Du musst angemeldet sein, um einen Kommentar abzugeben.
öffnen Sie Ihre
config/routes.php
Dateifügen Sie diese Zeile:
dann habe ich nie verwendet, eine so riesige
.htaccess
mit codeigniter verwende ich immer und es funktioniert Super:entfernen index.php Sie haben die Verwendung von htaccess und ändern in
config/config.php
:Bearbeiten Sie .htaccess fiel auf:
Obwohl
mycontrol
ist der Standard-controller, es ist nicht zur Arbeit gehen, weil es erwartet Sie einecontroller
genanntmyFunction
wenn Sielocalhost/projFolder/myFunction
. Wenn Sie möchten, den Zugangmyfunction
versuchen zu gebenlocalhost/projFolder/mycontrol/myFunction
. Mit diesem Ansatz werden Sie rufen den controller und Fragen, für eine bestimmte Funktion.