0

我在使用其他浏览器但不是 Firefox的重写时遇到问题

问题是我必须在 url 中使用引号,由于客户端错误的软件向我的脚本提交数据,我别无选择。

我使用 %27 对 url 中的引号进行编码(我在 php 中添加了安全性)。

# example.eu/horses/r/rollin-%27n-tumblin/
RewriteRule ^horses/(.*)/(.*)/$ index.php?page=viewHorse&letter=$1&horseName=$2 [L]

这在 Safari 和 Chrome 中有效(在 mac 和 windows 7 上测试),但 firefox 显示“页面未正确重定向”

ps 不是缓存问题

我是重写的初学者,所以我希望解决方案很简单,但我无法弄清楚为什么这条规则在其他浏览器中有效,但在 firefox 中无效

这是.htaccess

RewriteEngine on 
RewriteBase /
ErrorDocument 404 /404/
#Commented these out just to see if causing issues
#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#RewriteRule ^index.html http://www.example.eu/ [R=301,L]
#RewriteRule ^home.html http://www.example.eu/ [R=301,L]
#RewriteRule ^Home.html http://www.example.eu/ [R=301,L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_URI} !index.php
#RewriteCond %{REQUEST_URI} !^message-board/$
#RewriteCond %{REQUEST_URI} !(.*)/$
#RewriteRule ^(.*)$ http://www.example.eu/$1/ [L,R=301]
RewriteRule ^css/(.*)/$ /style.css
RewriteRule ^checkout/failed/$ index.php?page=checkoutFailed [L]
RewriteRule ^checkout/complete/$ index.php?page=checkoutComplete [L]
RewriteRule ^advertise/$ index.php?page=advertise [L]
RewriteRule ^contact/$ index.php?page=contact [L]
RewriteRule ^sales/$ index.php?page=sales [L]
RewriteRule ^news/$ index.php?page=news [L]
RewriteRule ^publications/$ index.php?page=publications [L]
RewriteRule ^generateSitemap/$ index.php?page=generateSitemap [L]
RewriteRule ^fixtures/(.*)/$ index.php?page=view-fixtures&country=$1 [L]
RewriteRule ^fixtures/$ index.php?page=fixtures [L]
RewriteRule ^results/(.*)/(.*)/(.*)/$ index.php?page=view-result&country=$1&date=$2&UniRef=$3 [L]
RewriteRule ^results/(.*)/(.*)/$ index.php?page=cresults&country=$1&date=$2 [L]
RewriteRule ^results/(.*)/$ index.php?page=results&country=$1 [L]
RewriteRule ^results/$ index.php?page=results [L]
RewriteRule ^horses/(.*)/(.*)/$ index.php?page=viewHorse&letter=$1&horseName=$2 [L]
RewriteRule ^horses/(.*)/$ index.php?page=horsesByLetter&letter=$1 [L]
RewriteRule ^horses/$ index.php?page=horsesByLetter [L]
RewriteRule ^search.php index.php?page=search&%{QUERY_STRING} [L]
RewriteRule ^404/$ index.php?page=404 [L]
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
<FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
Header set Cache-Control "max-age=2992000"
</FilesMatch>
<FilesMatch "\.(js|css|pdf|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>

问题在于 Mac OSX 10.8.2 上的 FF 16.0.1 显示错误“页面未正确重定向”

4

1 回答 1

0

原来我在 php 中有一个规范的 301 脚本,它的 url 编码有问题。

我猜 Firefox 对 $_SERVER['REQUEST_URI'] 中的 url 的编码与其他浏览器不同,但是......

改变……

$_SERVER['REQUEST_URI']

在 php 规范脚本中...

urldecode($_SERVER['REQUEST_URI'])

使其正确匹配 ' in url。:)

于 2012-11-02T14:37:45.240 回答