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
.htaccess有问题(mod_重写)。重写规则';斯多恩斯';我不能正常工作_.htaccess_Mod Rewrite - Fatal编程技术网

.htaccess有问题(mod_重写)。重写规则';斯多恩斯';我不能正常工作

.htaccess有问题(mod_重写)。重写规则';斯多恩斯';我不能正常工作,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我的两条规则有问题 .htaccess: # protect the htaccess file <files .htaccess> order allow,deny deny from all </files> RewriteEngine On Options +FollowSymlinks Options -Indexes RewriteBase /test/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{

我的两条规则有问题

.htaccess:

# protect the htaccess file
<files .htaccess>
 order allow,deny
 deny from all
</files>

RewriteEngine On
Options +FollowSymlinks
Options -Indexes
RewriteBase /test/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^download/([0-9]+)$ download.php?id=$1 [L]
RewriteRule ^(.*)$ index.php?c=view&misc=$1 [B]

有什么想法吗?

问题不在于规则。它在这里起作用

mydownload.php包含

Hi!
<br>Id = <?
echo $_GET['id'];
?>
你好!
Id= 规则是


重写规则^download/([0-9]+)$download.php?id=$1[L]


是否确定重写基应为/test/?

规则没有问题。它在这里起作用

mydownload.php包含

Hi!
<br>Id = <?
echo $_GET['id'];
?>
你好!
Id= 规则是


重写规则^download/([0-9]+)$download.php?id=$1[L]


你确定重写库应该是/test/?

好的,我解决了这个问题

# protect the htaccess file
<files .htaccess>
 order allow,deny
 deny from all
</files>

RewriteEngine On
Options +FollowSymlinks
Options -Indexes

RewriteBase /test/download/
RewriteRule ^download/([0-9]+)$ download.php?id=$1 [L]

RewriteBase /test/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?c=view&misc=$1 [B]
#保护htaccess文件
命令允许,拒绝
全盘否定
重新启动发动机
选项+FollowSymlinks
选项-索引
重写库/测试/下载/
重写规则^download/([0-9]+)$download.php?id=$1[L]
重写基础/测试/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?c=view&misc=$1[B]

谢谢大家!:)

好的,我解决了这个问题

# protect the htaccess file
<files .htaccess>
 order allow,deny
 deny from all
</files>

RewriteEngine On
Options +FollowSymlinks
Options -Indexes

RewriteBase /test/download/
RewriteRule ^download/([0-9]+)$ download.php?id=$1 [L]

RewriteBase /test/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?c=view&misc=$1 [B]
#保护htaccess文件
命令允许,拒绝
全盘否定
重新启动发动机
选项+FollowSymlinks
选项-索引
重写库/测试/下载/
重写规则^download/([0-9]+)$download.php?id=$1[L]
重写基础/测试/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?c=view&misc=$1[B]

谢谢大家!:)

对。我正在使用localhost和文件夹测试:但是添加第二条规则并重试。在这里非常有效。尝试将前缀test/添加到规则中,看看这是否是问题所在。为了好玩,我添加了RewriteBase规则,但它在这里不起作用。读也读是。我正在使用localhost和文件夹测试:但是添加第二条规则并重试。在这里非常有效。尝试将前缀test/添加到规则中,看看这是否是问题所在。为了好玩,我添加了RewriteBase规则,但它在这里不起作用。读也读