What is causing 404 error in CodeIgniter? |
I am attempting to install the latest version of CodeIgniter in a subdirectory, which has been successful thus far. However, I now aim to eliminate "index.php" from the URL. As a result, I have created an .htaccess file in the subfolder with the following directives:
RewriteEngine On RewriteBase /dev/ # Redirects trailing slashes to prevent SEO duplicate content issues RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301] # Disallows access to the system and application folders by users # This enables the creation of a System.php controller, which was previously impossible # Replace 'system' if your system folder has been renamed RewriteCond %{REQUEST_URI} ^system.* RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php/$1 [L] # Checks if the user is attempting to access a valid file, such as an image or CSS document # If not, the request is redirected to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] The name of the subdirectory is "dev", and the webroot (parent folder) is empty, containing only an index.html file. The resulting file structure is as follows: bash /var/www/ index.html dev/ CodeIgniter installation here .htaccess Mod-rewrite is enabled, but I am receiving a 404 error when attempting to call URLs without "index.php". Can you provide any insight into why this may be happening? |
Messages In This Thread |
What is causing 404 error in CodeIgniter? - by AkasHaedailya - 04-21-2023, 03:46 AM
RE: What is causing 404 error in CodeIgniter? - by SubrataJ - 04-21-2023, 04:13 AM
RE: What is causing 404 error in CodeIgniter? - by cbd - 06-11-2023, 11:24 AM
|