我在codeigniter中有一個項目,我有一個.htaccess文件,我用來隱藏用戶的index.php頁面。在本地機器上,當項目是在Windows操作系統中,但是當我在linux(ubuntu發行版)中測試時.htaccess功能不起作用。任何關於我能爲linux做什麼的建議都非常感謝。 我的.htaccess文件:我的.htaccess文件有什麼問題,以便它可以在linux上工作?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myproject/
### Canonicalize codeigniter URLs
# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(platform(/index)?)/?$/[L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]
# 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} !^(localhost|myproject) [NC]
RewriteRule ^(.*)$ http://localhost/myproject/$1 [L,R=301]
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
# 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]
</IfModule>
<IfModule !mod_rewrite.c>
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
正當我在開始時添加此非字符串gfgfgfgfgfgfg appication崩潰服務器遇到內部錯誤或配置錯誤,無法完成您的請求。 請與服務器管理員webmaster @ localhost聯繫,並告知他們發生錯誤的時間以及您可能已經造成錯誤的任何事情。 有關此錯誤的更多信息可能在服務器錯誤日誌中可用。 http:// localhost/myproject上的Apache/2.2.22(Ubuntu)服務器端口49131 – user1718215
因此,在Linux服務器上託管之後發生這種情況是很不可能的。然後爲了測試這個錯誤,我使用的是本地linux機器,錯誤是一樣的! – user1718215