mod_rewrite仅在firefox中被破坏

时间:2012-10-24 21:51:25

标签: apache firefox mod-rewrite

我遇到了重写的问题,正在其他浏览器中运行但不是firefox

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

我使用%27对网址中的引号进行编码(我在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问题显示错误“页面没有正确重定向”

1 个答案:

答案 0 :(得分:0)

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

我猜firefox对$ _SERVER ['REQUEST_URI']内的网址编码方式与其他浏览器不同,但是......

改变....

$_SERVER['REQUEST_URI']

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

urldecode($_SERVER['REQUEST_URI'])

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

相关问题