Codeigniter .htaccess

前端 未结 2 1247
滥情空心
滥情空心 2021-01-21 22:59

Sorry for my bad english...

I have the most basic possible CodeIgniter setup and can\'t make it work... if i access the url http://domain.com/index.php?controllerX/metho

相关标签:
2条回答
  • 2021-01-21 23:20

    I think your question is also answered here

    RewriteEngine On
    RewriteBase /
    
    # 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.plugb.com/$1 [L,R=301]
    
    
    RewriteBase /    
    RewriteCond %{HTTP_HOST} !=""
    RewriteRule ^index.php(/.*)?$ http://%{HTTP_HOST}$1 [R=301]
    # 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]
    
    0 讨论(0)
  • 2021-01-21 23:35

    change your .htaccess file as:

    apart from the changes we did in .htaccess file we also have to verify/changed the following setting :

    Apache to read .htaccess files located under the /var/www/html directory. You can do this by editing httpd.conf file:

    sudo nano /etc/httpd/conf/httpd.conf

    Find the section and change AllowOverride None to

    AllowOverride All
    
     <Directory /var/www/html>
        AllowOverride All
     </Directory>
    Save and exit.
    

    Now restart Apache to put the change into effect:

    sudo systemctl restart httpd

    rest this worked for me

    0 讨论(0)
提交回复
热议问题