繁体   English   中英

将正常工作的CodeIgniter网站移至子文件夹

[英]Moving working CodeIgniter website to subfolder

我有一个运行良好的网站作为我的虚拟主机(/ public_html)的根目录,但是最近我又购买了一个新域并将其停放在该域中,因此我需要一个子目录(/ public_html / newdomaindir)。

现在,我需要将整个网站移到一个子文件夹(/ public_html / website),并且在适应.htaccess文件时遇到了困难。

这是我在root时使用的旧的.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文件中的任何内容吗?

任何帮助是极大的赞赏。 谢谢。

这不是我最擅长的技能,但是我会尝试将您以前的.htaccess修改为以下形式:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^website.org$
RewriteRule ^/?$ "http\:\/\/www\.website\.org\/" [R=301,L]

# not sure what about this
#RewriteCond $1 !^website\/(index\.php|images|css|robots\.txt|js|icons|files|fonts|extplorer)
RewriteRule ^$ website/ [L]
RewriteRule ^(.+)$ website/index.php?/$1[L,QSA]

如果这不起作用,也许您会在此SO答案中找到一些线索。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM