PDA

View Full Version : 301 redirect old dynamic rewrite page to new one- help!



rowtc2
08-28-2008, 05:47 PM
I have a dynamic page for my products. In url i have now 2 static and 2 dynamic keywords (id number and title for each product). I want to redirect actual pages to new pages and eliminate fix keywords from url

HOW is situation NOW?
On FTP ,link to product is like this
PHP...
http://www.mysite.com/KEYWORD1-".$title."-KEYWORD2-".$doc_id.".htm

url is
http://www.mysite.com/KEYWORD1-John-KEYWORD2-1.htm
http://www.mysite.com/KEYWORD1-Maria-KEYWORD2-2.htm

htacces rule is:
RewriteRule ^KEYWORD1-(.*)-NKEYWORD2-(.*).htm productpage.htm?title=$1&doc_id=$2

What i need?
url like this
http://www.mysite.com/John-1.htm
http://www.mysite.com/$title-$id.htm

What have i done?
On FTP ,link to product is like this
PHP...
http://www.mysite.com/".$title."-".$doc_id.".htm

htacces rules are:
RewriteRule ^KEYWORD1-(.*)-NKEYWORD2-(.*).htm productpage.htm?title=$1&doc_id=$2
RewriteRule ^(.*)-(.*).htm productpage.htm?title=$1&doc_id=$2
Redirect permanent /KEYWORD1-(.*)-NKEYWORD2-(.*).htm http://www.mysite.com/.*)-(.*).htm

But it doesnt work redirection. :(

fileserverdirect
08-30-2008, 11:59 PM
It is much easier to do this without HTACSESS.
Quick Solution:
URL Example: www.mysite.com/products.php?title=John&doc_id=1
PHP:


<?php
$title= $_GET['title'];
$doc_id = $_GET['doc_id'];
header("location: $title-$doc_id.htm")
?>

Your product page's URL: John-1.htm .
Better Solution:
Create a MYSQL Database and enter all of the information to there, then remotly acsess and dispaly it with only 1 php page. Ask if you want more information ;)