Jump to content

htaccess help needed


Davie33

Recommended Posts

Hi how do i make the rule for htaccess file for this code i have ?.

 

so it can show like this.... http://localhost/template/cats/CPUs%20-%20Processors/1.html

 

I have this but doesnt seem to do the trick.

RewriteRule page-(.*)\.html$ index.php?act=$1&id&page=$2

 

<?php
$query = mysql_query("SELECT * FROM cats WHERE id ORDER BY catname ASC LIMIT 15") or die(mysql_error());
while ($row = mysql_fetch_assoc($query)) {
echo '<a href="' . $urlpath . 'cats/' . $row['catname'] .'/1.html">' . $row['catname'] . '</a> / ';	
}
?>

Link to comment
Share on other sites

I have this but doesnt seem to do the trick.

RewriteRule page-(.*)\.html$ index.php?act=$1&id&page=$2

Well yeah: that URL doesn't match up with what you're trying to use.

^cats/([^/]+)/(\d+)\.html$

(assuming this will go in /template/.htaccess)

Link to comment
Share on other sites

Yeah your right i don't know much about htaccess mod rewrite which i am reading up on.

 

This is my full rule which works apart from the 2nd one that only shows id and not catname.

 

Rewrite Rule ^cats/([^/]+)/(\d+)\.html$ index.php?act=cats&id=$1&page=$2

 

For the rule you gave me does work but not on its own so i added the 2nd part of the rewrite rule and works.

When i tryed your rule like this RewriteRule ^cats/([^/]+)/(\d+)\.html$ was getting error that's why i tryed with adding "" and it stopped the error but still didn't show the cat page so thats why i added the 2nd part of the rewrite rule.

 

So i would just like to thank you for the help thanks again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.