我的文件夹/文件结构为:
rootFolder/
lowRes/lowres.php
hiRes/hires.php
sys.php
基本上,我想做重写,例如当用户调用页面site.com/img_0001_hq.html,.htaccess 将其重写为sys.php?1=img_0001_hq。此外,我想将可接受的 emdings 限制为“.html”和“/”,如果不存在这样的结尾,我想调用 sys.php?1=p_404。重写按预期进行,但是当涉及到错误时......
当我调用页面 site.com/hiRes/hires.php 或 site.com/lowRes/lowres.php 时,重写不起作用,脚本(hires.php 和 lowres.php)运行,并报告错误,通常缺少变量来自未触发的 sys.php。此外,当我调用页面 site.com/hiRes 或 site.com/lowRes 时,sys.php 运行,但是,错误。此外,调用这些地址时,浏览器中的地址会更改为 site.com/hiRes/?1=p_404 或 site.com/lowRes/?1=p_404。到底他妈发生了什么?!:D
哦,是的,我的 .htaccess 看起来像这样:
IndexIgnore *
RewriteEngine on
RewriteRule ^(.*)(/|.html)$ sys.php?1=$1 [L]
RewriteRule ^(.*)$ sys.php?1=p_404 [L]
我要疯了... :)