【发布时间】:2015-02-26 01:08:51
【问题描述】:
我的 .htaccess 文件中有一组标准的 WordPress 重写:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
但我想避免对特定 URL 进行任何重写,即:
http://www.domain.com/wp-content/themes/jarvis_wp/css/i?w=400&h=250
我尝试在 WordPress 重写之上添加此规则:
RewriteRule ^css - [L,NC]
但这似乎不起作用。如何让浏览器加载该 URL 而无需任何重写?
这是“i”文件夹内的 index.php 文件中的代码,也许这可能与重定向有关,我不确定它来自哪里:
<?php
// Include placeholder generator class
require('placeholder.class.php');
// Get variables from $_GET
$width = isset($_GET['w']) ? trim($_GET['w']) : null;
$height = isset($_GET['h']) ? trim($_GET['h']) : null;
$backgroundColor = isset($_GET['bgColor']) ? strtolower(trim($_GET['bgColor'])) : null;
$textColor = isset($_GET['textColor']) ? strtolower(trim($_GET['textColor'])) : null;
$cache = isset($_GET['c']) && $_GET['c'] == 1 ? true : false;
try {
$placeholder = new Placeholder();
$placeholder->setWidth($width);
$placeholder->setHeight($height);
$placeholder->setCache($cache);
if ($backgroundColor) $placeholder->setBackgroundColor($backgroundColor);
if ($textColor) $placeholder->setTextColor($textColor);
$placeholder->render();
} catch (Exception $e){
die($e->getMessage());
}
谢谢!
【问题讨论】:
标签: apache .htaccess mod-rewrite