简体   繁体   中英

htaccess - rewrite only inside folder

I hava a folder - careers - and i want to do the rewrite only for the files of that folder, for example:

mydomain.com/file.html -> its out of the folder

mydomain.com/folerone/file.html -> its out of the folder

mydomain.com/careers/ -> this calls the file index.php

mydomain.com/careers/item -> this calls the file index.php with the $_GET variable item

mydomain.com/careers/item2 -> this calls the file index.php with the $_GET variable item2

My actual .htaccess is:

RewriteEngine on

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

This is not working.. can someone help?

将.htaccess文件放在careers文件夹中

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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