【发布时间】:2017-02-24 16:39:11
【问题描述】:
我已经为此工作了一个多小时,显然我错过了一些东西。
我需要重定向: www.site.com/directory/file.php?m=12345 到 www.site.com/file2.php?m=12345
无论我在做什么,不符合规则,数据丢失或重定向尝试转到同一目录。
我正在.htaccess 中进行重定向。 RewriteEngine 已打开,其他重定向正在运行。 在重写之前没有停止以防止规则被读取。 我正在使用这些标志 NC、R、L
DirectoryIndex Default3.php Default3.PHP
#Block listing of folder contents
IndexIgnore *
RewriteEngine on
#Make access to image folder case insentive
RewriteRule ^images/(.*) Images/$1
RewriteRule ^common/(.*) Common/$1
#redirect old photo download page
RewriteRule GetZipPhotos.*(\d*) PhotoDownload.php?mls=$1 [NC,QAS,L]
感谢您的帮助。
我已将 .htaccess 更改为
DirectoryIndex Default3.php Default3.PHP
#Block listing of folder contents
IndexIgnore *
RewriteEngine on
#redirect old photo download page
RewriteRule ^Agents_Admin/GetZipPhotos.php(.*) /PhotoDownload.php$1 [R,NC,L]
#Make access to image folder case insentive
RewriteRule ^images/(.*) Images/$1
RewriteRule ^common/(.*) Common/$1`
重写仍然无法正常工作。根据 htaccess 测试器,这确实捕获了原始 URL,并且应该正确重定向。但事实并非如此。原始文件不断运行。
【问题讨论】:
-
如果你分享你的代码,有人可以尝试帮助..
-
这是一行语句,但这里是 RewriteRule file\.php\?\=*(\d*) file2.php?mls=$1 [NC,QAS,L]跨度>
-
那一行比 10 行解释更有帮助。