htaccess-只在文件夹内重写


htaccess - rewrite only inside folder

我有一个文件夹-职业-我只想重写该文件夹中的文件,例如:

mydomain.com/file.html->它在文件夹外

mydomain.com/folerone/file.html->它在文件夹外

mydomain.com/careers/->这将调用文件index.php

mydomain.com/careers/item->这将调用带有$_GET变量项的文件index.php

mydomain.com/careers/item2->这将调用带有$_GET变量item2-的文件index.php

我实际的.htaccess是:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([^/]+) index.php?itemid=$1 [QSA]

这不起作用。。有人能帮忙吗?

将.htaccess文件放入职业文件夹中

RewriteRule item([0-9]*)?$ index.php?itemid=item$1 [QSA]