Hi Guys,
I’m not sure if this is an .htaccess problem or my php, i have my site pages rewritten like:
Options +FollowSymLinks
RewriteEngine on
RewriteRule contact-us contact-us.php?
RewriteRule home index.php?
RewriteRule login login.php?
RewriteRule privacy-policy privacy-policy.php?
RewriteRule shopping-cart shopping-cart.php?
RewriteRule sitemap sitemap.php?
RewriteRule terms-of-service terms-of-service.php?
On my cart page i was trying to remove items, normally i would do: shopping-cart.php?action=remove, i assume because i have rewritten the URLs i don’t have access to the $_GET so i tried shopping-cart/?action-remove but no luck
any help would be appreciated
thanks guys
Graham
Hi Scal,
Can you believe it was the javascript! lol
thanks for the help mate
Graham
- Remove the question marks at the end of the RewriteRule
- Append [L,QSA] to each RewriteRule (Last, Query String Append)
Options +FollowSymLinks
RewriteEngine on
RewriteRule contact-us contact-us.php [L,QSA]
RewriteRule home index.php [L,QSA]
RewriteRule login login.php [L,QSA]
RewriteRule privacy-policy privacy-policy.php [L,QSA]
RewriteRule shopping-cart shopping-cart.php [L,QSA]
RewriteRule sitemap sitemap.php [L,QSA]
RewriteRule terms-of-service terms-of-service.php [L,QSA]
Alternatively you can do it like this
RewriteRule ^(contact-us|home|login|privacy-policy|shopping-cart|sitemap|terms-of-service)$ $1.php [L,QSA]
Hi Scallio,
Thanks for that, i ammended the rewrite code, and i put:
<?php
if (isset($_GET['action']))
{
print "set";
} else {
print "not set";
}
?>
Just above the cart code for testing purposes the button looks like:
<td width="1" height="10" bgcolor="#6c6c6c"></td>
<td width="10"></td>
<td width="50" align="center"><a href="../shopping-cart?action=remove" onclick="removeBasketProd('SAM-BD5300');refresh();"><img src="../images/basket_removeItem.gif" width="20" height="20" border="0" alt="Remove item from basket" /></a></td>
<td width="10"></td>
<td width="20">
i have tried:
shopping-cart?action=remove
shopping-cart.php?action=remove
I can’t get the isset to set for some reason.
thanks mate
Graham
I noticed if i paste “shopping-cart/?action=remove” manually in the url it works like it should, but it doesn’t seem to work when i press the html button below:
<td width="1" height="10" bgcolor="#6c6c6c"></td>
<td width="10"></td>
<td width="50" align="center"><a href="../shopping-cart/?action=remove" onclick="removeBasketProd('SAM-BD5300');refresh();"><img src="../images/basket_removeItem.gif" width="20" height="20" border="0" alt="Remove item from basket" /></a></td>
it just reloads the page like it is working but doesn’t set anything.
cheers
Graham