index.php, .htaccess and config |
[eluser]Unknown[/eluser]
OK, I'm on Apache 2.28, php 5.2.5 and have made the following mods... I added a file.. /.htaccess... # Deny OR Allow Folder Indexes. # Since we disable access to PHP files you # can leave this on without worries. # OR better yet, create a .htaccess file in # the dir you want to allow browsing and # set it to +Indexes Options -Indexes Options +FollowSymLinks # Set the default file for indexes DirectoryIndex index.php <IfModule mod_rewrite.c> # mod_rewrite rules RewriteEngine on # The RewriteBase of the system (if you are using this sytem in a sub-folder). RewriteBase /anydomain/ # This will make the site only accessible without the "www." # (which will keep the subdomain-sensive config file happy) # If you want the site to be accessed WITH the "www." # comment-out the following two lines. # RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC] # RewriteRule ^(.*)$ http://site.com/$1 [L,R=301] # If a controler can't be found - then issue a 404 error from PHP # Error messages (via the "error" plugin) ErrorDocument 403 /index.php/403/ ErrorDocument 404 /index.php/404/ ErrorDocument 500 /index.php/500/ # Deny any people (or bots) from the following sites: (to stop spam comments) # RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR] # RewriteCond %{HTTP_REFERER} porn\.com # RewriteRule .* - [F] # Note: if you are having trouble from a certain URL just # add it above to forbide all visitors from that site. # You can also uncomment this if you know the IP: # Deny from 192.168.1.1 # If the file is NOT the index.php file RewriteCond %{REQUEST_FILENAME} !/northofthweb-com/index.php # Hide all PHP files so none can be accessed by HTTP RewriteRule (.*)\.php$ /anydomain/index.php/$1 # If the file/dir is NOT real go to index RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /anydomain/index.php/$1 [QSA,L] </IfModule> # If Mod_ewrite is NOT installed go to index.php <IfModule !mod_rewrite.c> ErrorDocument 404 index.php </IfModule> I changed.. /system/application/config/config.php... $config['base_url'] = "http://localhost/anydomain/"; $config['index_page'] = ""; I changed.. /system/application/config/routes.php... $route['default_controller'] = "home"; When I hit http://localhost/anydomain it goes into my controller/home.php file, HTML is displayed and every thing works fine. From this page, I have link which goes to http://localhost/anydomain/page2 My problem is this... When I hit http://localhost/anydomain/page2, I am expecting it to go into my /controller/page2.php file and the HTML would be displayed as normal, however, the browser only returns the text "index.php" I view source on the page and the only text inside it is "index.php" Anybody any ideas why this is happening?
[eluser]Jay Logan[/eluser]
In your config file, try changing uri_protocol to REQUEST_URI instead of AUTO.
[eluser]Unknown[/eluser]
Have just tried that and it makes it worse! If i change it to REQUEST_URI, it won't even load my home page. I also tried PATH_INFO and ORIG_PATH_INFO. This is such a shame as I really want to start using CI but after a fresh install, 2 controllers and 2 views, I can't even get the most basic of basic functionality working. All I want to do is lost the index.php/ from the URL. Surely this should be something very basic and easy to change (if not already set up by default)? |
Welcome Guest, Not a member yet? Register Sign In |