Codeigniter htaccess and base_url

前端 未结 3 1785
花落未央
花落未央 2021-01-23 15:54

I install codeigniter and start to write some code on it.First i want to remove index.php and make some research about it.I remove it with a small htaccess code below,



        
3条回答
  •  独厮守ぢ
    2021-01-23 16:42

    try this

    RewriteEngine on
    RewriteBase /pasaj/
    RewriteCond $1 !^(index\.php|images|css|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L]
    

    My htaccess files on a local server looks like this:

    For a Zend Framework web:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    

    For a CodeIgniter web:

    RewriteEngine on
    RewriteBase /pasaj/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
    

提交回复
热议问题