mod_rewrite example step by step
Follow the step-by-step instructions below to create a working mod_rewrite + URL Schema example same as what we have at DFF example.
DFF mod_rewrite example link:
http://www.datafeedfile.com/examples/modrewrite/pse.html
Step 1 - Enter URL Schema
1.
Login to ACP (affiliate control panel)
2. Go to
Settings > URL Schemas tab
3. Create a new
URL schema #1 with the following
http://www.datafeedfile.com/compare_price-<<<seo>>>-<<<param>>>
inside the Product Price Comparison text box.
4. You can enter any Schema Name
5. Save the URL Schema
Step 2 - Add mod_rewrite in Apache httpd.conf or .htaccess file
Depending on your web server setting / environment, you must enter the following mod_rewrite rules in either httpd.conf (apache main configuration file) or .htaccess (per directory configuration file).
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.
Step 3 - Create compareprice.html or compareprice.php
Create a new HTML or PHP file at your ROOT directory name it compareprice. and put the following source into it:
For HTML (javascript):
<script type="text/javascript" src="http://www.datafeedfile.com/dff_jsthrow.php?affid=1001&script=prdtmain&style=2"></script>
For PHP:
<?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']);
}
?>
Step 4 - Test the product price comparison page
Load the compareprice. page you have just created like this:
http://www.yourdomainname.com/compareprice.html
or
http://www.yourdomainname.com/compareprice.php
It should complain about missing DFFSKU. That is correct, don't panic
Step 5 - Test from Price Search Engine script
To perform a complete 100% test you have to do a test starting from the Price Search Engine (PSE) page. Both the standard and CSS based PSE currently support mod_rewrite + URL schema functionality. You can either modify any of your own current page(s) that contains PSE to include an additional parameter (mr=
or dffget_mr=) or you can create a new PSE page just for testing.
GET HTML feature that generates PSE codes has been modified to allow selection of URL Schema, please use the GET HTML to generate your new PSE include string to support mod_rewrite.
Here is a link to our PSE example:
http://www.datafeedfile.com/examples/modrewrite/pse.html
For HTML (javascript):
<script type="text/javascript" src="http://www.datafeedfile.com/dff_jsthrow.php?affid=1001&script=search_index&style=2&mr=1"></script>
For PHP:
<?php
include('http://www.datafeedfile.com/dffphp_script_search_index.php?dffget_affid=1001&dffget_style=2&dffget_mr=1&'.$_SERVER['QUERY_STRING']);
?>
Step 6 - Report any problem using Ticket System
Please report any bugs or issues using DFF's Support Ticket System and make sure you include the URL of the page where you are trying to deploy the mod_rewrite at along with description of what you are trying to accomplish.