close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

HTACCESS Friendly URL doesnt work

Thread began 8/15/2014 2:19 am by Christopher West | Last modified 8/19/2014 10:09 am by Christopher West | 1109 views | 18 replies

Jamie

Sorry, mod rewrite tends to get really confusing to me for my own stuff let alone someone elses code! lol

I *think* I am understanding what you want to do and is similar in nature to another of my sites: http://foodiesonholiday.co.uk/on-holiday.php

On that page, the sections are being dynamically brought in from the db and then the link to each section is being rewritten on the fly with the target page being filtered based on the ctaegory section that was selected on the previous page.

There are 2 rewrites going on:

1. The section itself - on the page http://foodiesonholiday.co.uk/on-holiday.php you will notice that when you hover the different sections, the URL structure is http://foodiesonholiday.co.uk/section/fresh-fish (for example)
2. on the target page (eg http://foodiesonholiday.co.uk/section/fresh-fish) the products that are then listed on that page are using the structure http://www.foodiesonholiday.co.uk/product/fresh-crab

As you can see, one is using /section/ and the other is using /product/

To re-write, the .htaccess for these 2 is:

RewriteEngine on
RewriteRule ^section/(.*)$ onholiday.php?perm=$1 [NC,L,QSA,T=application/x-httpd-php]
RewriteRule ^product/(.*)$ product-item.php?perm=$1 [NC,L,QSA,T=application/x-httpd-php]



the onholiday.php (listing the Categories/Sections) page (driving the sections pages) uses the following RS structure:

<?php
$colname_RSName = "-1";
if (isset($_GET['perm'])) {
$colname_RSName = $_GET['perm'];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_RSName = sprintf("SELECT * FROM table_name WHERE Permalink = %s", GetSQLValueString($colname_RSName, "text"));
$RSName = mysql_query($query_RSName, $PowerCMSConnection) or die(mysql_error());
$row_RSName = mysql_fetch_assoc($RSName);
$totalRows_RSName = mysql_num_rows($RSName);

if ($row_RSName) $_GET['KeyColumnID']= $row_RSName['KeyColumnID'];
?>



the product-item.php (listing the Products within the Category/Section selected) page (driving the product pages) uses the following RS structure:

<?php
$colname_RSNamePerm = "-1";
if (isset($_GET['perm'])) {
$colname_RSNamePerm = $_GET['perm'];
}

$colname_RSName = "-1";
if (isset($_GET['ProductID'])) {
$colname_RSName = $_GET['ProductID'];
}
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_RSName = sprintf("SELECT * FROM table_name WHERE KeyColumnID = %s OR Permalink = %s", GetSQLValueString($colname_RSName, "text"),GetSQLValueString($colname_RSNamePerm, "text"));
$RSName = mysql_query($query_RSName, $PowerCMSConnection) or die(mysql_error());
$row_RSName = mysql_fetch_assoc($RSName);
$totalRows_RSName = mysql_num_rows($RSName);
?>



Obviously each product/section needs its on unique Permalink set as a column in the table for this to work.

As I said, it seems that what you're trying to achieve is structurally similar to what I have done here and am more than happy to help more directly if my explanation is as clear as mud... just get in touch through my WA profile: http://www.webassist.com/developers/Jamie. If I am wrong in my assumption, really sorry!

Jamie

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...