Php .htaccess重写规则在远程站点上不起作用
这是我的.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
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?