mod_rewrite仅在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显示"页面无法正确重定向"

P.S这不是缓存问题

我是重写的初学者,所以我希望解决方案很简单,但是我无法弄清楚为什么该规则在其他浏览器中起作用,而不是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,显示错误"该页面未正确重定向"

事实证明,我在PHP中有一个典型的301脚本,该脚本与URL编码有问题。

我猜Firefox对$ _server ['request_uri']内部的URL编码与其他浏览器不同,但是...

更改....

$_SERVER['REQUEST_URI']

在php的规范脚本中,...

urldecode($_SERVER['REQUEST_URI'])

使其在URL中正确匹配。:)

最新更新