我有一個完美工作的網站作爲我的虛擬主機(/ public_html)的根,但我最近買了一個新域名並將它停放在那裏,所以我需要一個子目錄(/ public_html/newdomaindir)。將CodeIgniter網站移動到子文件夾
現在我需要將整個網站移動到一個子文件夾(/ public_html /網站),我很難適應.htaccess文件。
這是我的老工作的.htaccess文件時,它是根:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^website.org$
RewriteRule ^/?$ "http\:\/\/www\.website\.org\/" [R=301,L]
#SetEnvIfNoCase Host ^www\.website\.org$ require_auth=true
RewriteCond $1 !^(index\.php|images|css|robots\.txt|js|icons|files|fonts|extplorer)
RewriteRule ^(.+)$ /index.php?/$1[L,QSA]
而且現在的虛擬主機提供商的支持表明,我有這個.htaccess文件爲根,以重定向流量。
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} website.org$
RewriteCond %{REQUEST_URI} !website/
RewriteRule ^(.*)$ website/$1
但是,呃......它沒有像預期的那樣工作。我的網站壞了。
我應該使用不同的方法,也許要求支持人員更改我的網站的document_root?我應該更改子文件夾.htaccess文件中的任何內容嗎?
任何幫助,非常感謝。謝謝。
您是否嘗試通過更改CI配置文件中的'base url' – 2015-04-03 13:35:07
這應該不會改變。它仍然是'$ config ['base_url'] \t ='http://www.website.org/';' – 2015-04-03 13:38:26
請嘗試更改'$ config ['base_url'] \t ='http://www.website .org /';'到'$ config ['base_url'] ='http://www.website.org/website';'與原始.htaccess – 2015-04-03 13:42:37