[英]Need help on Mod Rewrite .htaccess parent folder and 1 subfolder
I am not really good on understand .htaccess rewrite, and this one give me headache. 我不太了解.htaccess重写,这一点让我头疼。
I have domain.com
, and 1 folder called: app/webroot/
我有domain.com
,还有1个名为: app/webroot/
文件夹
I want everything: domain.com/*
will be rewrite to folder domain.com/app/webroot/*
我需要所有内容: domain.com/*
将被重写为文件夹domain.com/app/webroot/*
Then this is make me crazy. 那就让我发疯了。 I have 1 folder for admin, called "system"
under domain.com too. 我也有1个用于管理的文件夹,也称为domain.com下的"system"
。 Everything under domain.com/system will not be rewrite to the webroot. domain.com/system下的所有内容都不会被重写为webroot。
And finally, I want system/something
will be rewrite to /system/index.php?subpage=something
最后,我希望将system/something
重写为/system/index.php?subpage=something
Really sorry if you guy think this is easy and I can not do it, but I stuck with it whole days already. 真的很抱歉,如果您认为这很容易并且我无法做到,但是我已经整天坚持了下来。
Here is what I have tried to do: 这是我尝试做的事情:
RewriteEngine on
RewriteRule ^(.*)$ app/webroot/$1 [L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^/?(system)/?([^/]+)/?$ /system/index.php?subpage=$1 [NC,L,QSA]
RewriteRule ^/?(system)/?([^/]+)/([^/]+)/?$ /system/index.php?subpage=$1&action=$2 [NC,L,QSA]
RewriteRule ^/?(system)/?([^/]+)/([^/]+)/([^/]+)/?$ /system/index.php?subpage=$1&action=$2¶m=$3 [NC,L,QSA]
nvm, i got it. NVM,我明白了。
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ app/webroot/$1 [L]
RewriteRule ^/?(system)/?([^/]+)/?$ /system/index.php?subpage=$2 [NC,L,QSA]
RewriteRule ^/?(system)/?([^/]+)/([^/]+)/?$ /system/index.php?subpage=$2&action=$3 [NC,L,QSA]
RewriteRule ^/?(system)/?([^/]+)/([^/]+)/([^/]+)/?$ /system/index.php?subpage=$2&action=$3¶m=$4 [NC,L,QSA]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.