codeigniter htaccess file in subdomain

廉价感情. 提交于 2019-12-12 02:11: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



来源:https://stackoverflow.com/questions/42265054/codeigniter-htaccess-file-in-subdomain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!