Results 1 to 2 of 2

Thread: 301 redirect old dynamic rewrite page to new one- help!

  1. #1
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 301 redirect old dynamic rewrite page to new one- help!

    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.

  2. #2
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    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 Code:
    <?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
    Last edited by fileserverdirect; 08-31-2008 at 12:01 AM. Reason: Added product URL example
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •