感谢您的阅读。首先,我得到了一个内部的.htaccess用下面的语句我的根目录:
Thanks for reading. First of all, I got one .htaccess inside my root directory with the following statement :
# Mod Rewrite
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ /root/ [L]
RewriteRule (.*) /root/$1 [L]
</IfModule>
和根文件夹中我得到了这个文件:
and inside root folder I got this file :
# Mod Rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /root/index.php/$1 [PT,L]
</IfModule>
此外,在文件夹 /根
,我有三个文件夹: CSS
, JS
和图片
。
Also, in the folder /root
, I got three folders : css
, js
and images
.
我的应用程序的设计是从我的MVC框架(有点像codeGgniter为)隔开。因此,这里的树:
My application is designed to be separated from my MVC framework (a bit like CodeGgniter is). So here's the tree :
- application
- my application files are there
- root
- css
- js
- images
- grecko
- my mvc framework files are there
这样,我可以更新我的框架,而不触及整个网站下的应用程序文件夹中运行谁。
Like this, I can update my framework without touching the entire website who run under the application folder.
不管怎样,我想现在要做的是将上述三个文件夹我上面说的( CSS
, JS
和图片
)内和移动 /应用/资产/
。但是,因为一切都被重定向到 /根/
,我需要一个规则,允许这样的请求 HTTP://www.domain.tld/css /blabla.css
映射到 /application/assets/css/blabla.css
等。
Anyway, what I would like to do now is to move the three folder I said above ( css
, js
and images
) and move them inside /application/assets/
. But since everything is redirected to /root/
, I will need a rule that allow request like that http://www.domain.tld/css/blabla.css
to be mapped to /application/assets/css/blabla.css
, etc.
我没有尝试,但都没有成功。
I did try but without success.
感谢。
将这个code。在 $ DOCUMENT_ROOT /的.htaccess
:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^(css|js|images)(/.*|)$ application/assets/$1$2 [L,NC]
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule ^ root${REQUEST_URI} [L]
</IfModule>