Table of Contents7.3.
Using mod_rewrite + URL Schemas with Search Engine
This page will describe how to use mod_rewrite and URL Schemas to manipulate URLs generated by DFF scripts.
mod_rewrite is a module of Apache web server which allows matching of certain rules to rewrite URLs.
URL Schema is a feature in DFF that allows affiliates to control the behaviour of specific script's URLs
This feature will have many SEO benefits as SE robots usualy like static looking URLs rather than dynamic page URLs.
However this feature is quite difficult to implement because it requires good understanding of Apache server, mod_rewrite and DFF scripts.
Requirements
1. Apache server with mod_rewrite module
2. Access to httpd.conf or .htaccess
3. Knowledge of how mod_rewrite works
4. Knowledge of how
DFF URL Schemas works
5. Knowledge of how DFF scripts URLs works
Learning from example
Example link:
http://www.datafeedfile.com/examples/modrewrite/pse.html
> Hover on any of the product text title links and observe the target URLs.
> Click on the product text title links, notice that the URL contains SEO keywords and only one (DFF SKU) parameter.
The product links of this example page has been changed because it has been controlled by the DFF URL Schema functionality.
We suggest you create a duplicate of this working example on your server to understand the behaviour of DFF mod_rewrite, follow this
step-by-step instructions.
Apache Configuration for mod_rewrite
This is the actual rule used to make the example work. These lines below can be put inside httpd.conf (inside
tag) or inside .htaccess).
Apache 1.x or 2.x:
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteRule ^(.*)/compare_price-(.*)-([0-9]+)$ /compareprice.php?dffsku=$3 [L,QSA]
Lighttpd 1.x:
url.rewrite-once = (
"^(.*)/compare_price-(.*)-([0-9]+)?(.*)$" => "/examples/modrewrite/compareprice.php?dffsku=$3&$4"
)
Note: Most server require Web Server's process restart to load new configuration changes into effect.
Source content of compareprice.php
compareprice.php is the destination page when a click is generated from the PSE (price search engine) to the Product Price Comparison page using the URL Schema.
compareprice.php need to grab the 'dffsku' variable from the URL query string and pass that into the PHP include string. See the content below:
<?php
$dffsku=trim($_GET['dffsku']);
if($dffsku=="") { echo "Need DFFSKU<br>"; exit; }
else
{
include('http://www.datafeedfile.com/dffphp_script_prdtmain.php?dffget_affid=1001&dffget_style=2&dffget_dff_product_sku='.$dffsku.'&'.$_SERVER['QUERY_STRING']);
}
?>