Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.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

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_Get_Rewrite - Fatal编程技术网

Php .htaccess重写规则在远程站点上不起作用

Php .htaccess重写规则在远程站点上不起作用,php,.htaccess,get,rewrite,Php,.htaccess,Get,Rewrite,这是我的.htaccess文件中的代码 RewriteEngine On DirectoryIndex index.php RewriteRule ^items/(\d+)/?$ items.php?item_id=$1 我的目录结构: |_root_folder_name |-->category |_ .htaccess |_ index.php |_ items.php url:localhost/root\u folder\u name/catego

这是我的.htaccess文件中的代码

RewriteEngine On
DirectoryIndex index.php

RewriteRule ^items/(\d+)/?$     items.php?item_id=$1
我的目录结构:

|_root_folder_name
|-->category
   |_ .htaccess
   |_ index.php
   |_ items.php
url:localhost/root\u folder\u name/category/items/2/。它在本地机器上正常工作,我得到echo$\u get['item\u id']的值为2。但是当我访问url为xyz.com/category/items/2的远程站点时/

根本没有检测到item_id变量。我尝试了print\u r$\u GET,它打印了一个空数组

你能指出我的重写规则有什么问题吗。我希望我能够正确地解释这个问题。

解决了它


经过多次尝试,我只是将文件名从items.php更改为item.php,现在它可以正常工作了。我猜重写规则和文件名之间存在冲突,因为它们相似。

您能否提供有关本地和远程服务器环境的更多信息,如apache版本、操作系统,您是否在远程服务器上的目录指令中添加了AllowOverride all?