关于.htaccess的难题

时间:2018-02-07 11:28:15

标签: apache .htaccess

文件夹结构:

web
- bar
  - index.php // echo 'you are inside bar'
  - .htaccess
- foo
  - index.php // echo 'you are inside foo'
  - .htaccess

我必须写在.htaccess栏中,请求栏/页面从foo文件夹中启动index.php?

1 个答案:

答案 0 :(得分:1)

您可以在bar/.htaccess

中使用此规则
RewriteEngine On

RewriteRule ^page(/.*)?$ /foo/index.php [L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]