codeigniter htaccess file in subdomain

2019-09-13 23:37发布

问题:

I did a project in codeigniter. It worked perfect in localhost. The htaccess file in localhost:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*) index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

Then i removed the project to hosting to subdomain college.utest.kz But it did not work on the internet. Changed the htaccess file content as in codeigniter documentation. The result is the same Thank you for reading

回答1:

Try

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>


回答2:

RewriteEngine on

 RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots  \.txt|favicon\.ico)
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]


回答3:

RewriteEngine On
RewriteBase /subdomain_name
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Use your subdomain folder name rewrite base