...

View Full Version : I Need A Little Help On URL ReWriting!



designer76
04-30-2011, 11:20 PM
I am having a little trouble using the Mod rewrite in .htaccess to rewrite my url when I click my paging links. I have included some sample rewrite attempts that I have failed to get working, and a small sample of what some of my paging code looks like. For the life of me, I can't get this to work correctly.

Basically I want: http://www.domain.com/portfolio?page=1

To look like: http://www.domain.com/portfolio/1


My Rewrite Attempt Examples:



RewriteRule ^/([0-9]+)$ /$targetpage?page=$1

RewriteRule ^portfolio/([0-9]+)/$ /targetpage?page=$1 [L]


Small Snippet Of Paging Code Example:



$top_pagination .= "<a class='search_pages' href='$targetpage?page=$counter'>$counter</a>";
}
$top_pagination .= "<a class='search_pages' href='$targetpage?page=$lpm1'>$lpm1</a>";
$top_pagination .= "<a class='search_pages' href='$targetpage?page=$lastpage'>$lastpage</a>";
}

else
{
$top_pagination .= "<a class='search_pages' href='$targetpage?page=1'>1</a>";
$top_pagination .= "<a class='search_pages' href='$targetpage?page=2'>2</a>";

m4rc3
05-12-2011, 05:05 AM
Your thread got me thinking and this is what I came up with:

RewriteCond %{QUERY_STRING} ^page=(.*)$
RewriteRule http://www.domain.com%{REQUEST_URI}/$1

Please try it and let me know because I'm falling asleep and i'm not sure if it will work or be a complete fail :D

Mayhem30
05-12-2011, 07:31 PM
Try this :


rewriterule ^portfolio/(.*)$ targetpage?page=$1



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum