Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用htaccess重定向到*页_Php_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

Php 使用htaccess重定向到*页

Php 使用htaccess重定向到*页,php,.htaccess,mod-rewrite,redirect,Php,.htaccess,Mod Rewrite,Redirect,我正在使用一个名为“onedrive/example/”的目录 在dir示例中,存储了我的所有php文件 现在我想使用htaccess重定向如下: 当有人试图访问htaccess时,需要将用户重定向到 但我该如何创造呢?我已经试过了: Options +FollowSymLinks RewriteEngine on php_flag session.bug_compat_42 0 php_flag session.bug_compat_warn 0 php_value memory_lim

我正在使用一个名为“onedrive/example/”的目录 在dir示例中,存储了我的所有php文件

现在我想使用htaccess重定向如下:

当有人试图访问htaccess时,需要将用户重定向到

但我该如何创造呢?我已经试过了:

Options +FollowSymLinks 
RewriteEngine on

php_flag session.bug_compat_42 0
php_flag session.bug_compat_warn 0

php_value memory_limit 64M

RewriteRule ^onedrive-redirect/(.*)/ ./onedrive/example/$1.php
RewriteRule ^onedrive-redirect/(.*) ./onedrive/example/$1.php

但是这个例子不适合我。有人能帮我让它工作吗?

您可以在
文档中使用此代码。\u ROOT/.htaccess
文件(
onedrive
的父目录):

RewriteEngine On
RewriteBase /

RewriteRule ^onedrive-redirect(/.*)$ /onedrive/example$1 [L,NC]