簡體   English   中英

刪除codeigniter中的index.php。 我的項目在子文件夾中

[英]remove index.php in codeigniter. my project is in subfolder

我正在嘗試刪除codeigniter.my中的index.php ,我的codegiter項目位於public_html/programemis/lasoona/ 。我的.htacess文件包含以下代碼。

RewriteEngine on
RewriteBase /lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

但它不起作用。任何人都可以幫助。

嘗試這個 :

RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /programemis/lasoona/index.php?/$1 [L,QSA]

在線上已經發布了很多解決方案。 這是來自stackoverflow本身:

Codeigniter刪除index.php-htaccess本地主機

如果它不起作用,則基於以下內容的另一個(對我有用):

https://docs.expressionengine.com/latest/urls/remove_index.php.html

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule .* index.php/$0 [PT,L]
</IfModule>

請注意.htaccess的位置。

在此處輸入圖片說明

我使用它並嘗試嘗試。 如果不起作用,請從RewriteBase中刪除programemis文件夾。 如果您遇到相同的問題,我建議您創建一個子域。

RewriteEngine on
RewriteBase /programemis/lasoona/
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM