Search code examples
.htaccesscodeignitermod-rewritecodeigniter-2

htaccess rewriterule ignore index.html


I'm using CodeIgniter and .htaccess to rewrite the URLs but I want it to ignore index.html.

This is so we can upload an index.html at any time as this will be a temporary landing page. With a link through to the main site on the index.php.

This is what is currently in .htaccess and I have set the server's directory index to index.html index.php

RewriteEngine on

RewriteCond $1 !^(index\.html|index\.php|js|img|fonts|data|css|uploaded|mobile_devices|audioplayer|emails|robots\.txt|archive_blog)

RewriteRule ^(.*)$ /index.php/$1 [L]

Thanks for any help


Solution

  • that rather looks like you want to rewrite everything that does not really exist in your directory.

    try this instead of your current RewriteCond:

    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1