繁体   English   中英

在Mod Rewrite .htaccess父文件夹和1个子文件夹上需要帮助

[英]Need help on Mod Rewrite .htaccess parent folder and 1 subfolder

我不太了解.htaccess重写,这一点让我头疼。

我有domain.com ,还有1个名为: app/webroot/文件夹

  1. 我需要所有内容: domain.com/*将被重写为文件夹domain.com/app/webroot/*

  2. 那就让我发疯了。 我也有1个用于管理的文件夹,也称为domain.com下的"system" domain.com/system下的所有内容都不会被重写为webroot。

  3. 最后,我希望将system/something重写为/system/index.php?subpage=something

真的很抱歉,如果您认为这很容易并且我无法做到,但是我已经整天坚持了下来。

这是我尝试做的事情:

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&param=$3 [NC,L,QSA]

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&param=$4 [NC,L,QSA]

暂无
暂无

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

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