我有一个安装concrete5住在我的网站根 - 问题是,C5的文件结构是pretty的多样化,而且越来越混在我的子目录和子域。我不能告诉什么是我的code,什么是C5,我恨它。
I've got an install of concrete5 living in my site root - the problem is that the C5 file structure is pretty varied, and it's getting mixed in with my subdirs and subdomains. I can't tell what's my code and what's C5, I hate it.
我的解决办法是将一切A / _concrete /文件夹 - 但因为我的域名已经指向了根,我不能在这里使用的文件
My solution is to move everything to a /_concrete/ folder - but since my domain has to point to the root, I can't use the files here.
输入的.htaccess:我需要编写一个脚本来重定向www.domain.com的任何实例(忽略子域)以www.domain.com/_concrete/~~V - 但不是一个透明的301,只是一个别名。为了澄清: www.domain.com/page /
和 www.domain.com/_concrete/page /
应显示一样的东西。 www.domain.com/page /
不应该改变它的网址 www.domain.com/_concrete/page /
Enter .htaccess: I need to write a script to redirect any instance of www.domain.com (ignore subdomains) to www.domain.com/_concrete/ - but not a transparent 301, just an alias. To clarify: www.domain.com/page/
and www.domain.com/_concrete/page/
should display the same thing. www.domain.com/page/
should NOT change it's URL to www.domain.com/_concrete/page/
.
我从一个类似的脚本我用在其他地方采用了这种
I've adapted this from a similar script I use elsewhere:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /_concrete/$1 [L,QSA]
但是,这不仅造成了服务器错误。我希望我靠近 - 任何人都可以点我在正确的方向。
But this only causes a server error. I hope I'm close - can anyone point me in the right direction?
您告诉服务器来检查值不是一个文件名,但你没有它忽略 _concrete
目录本身(这也符合你的脚本,并创建一个循环)。
You're telling the server to check if the value is not a filename, but you're not having it ignore the _concrete
directory itself (which would also match your script and create a loop).
这可能让你更接近你想要做的事情。
This might get you closer to what you're trying to do.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !^_concrete
RewriteRule ^(.*)$ _concrete/$1 [L,QSA]
此外,你可能希望它忽略存在,以及目录。在这一点 _concrete
将不再匹配,因为它的存在。
Additionally you might want to have it ignore directories that exist as well. At which point _concrete
would no longer be matched because it exists.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ _concrete/$1 [L,QSA]