Results 1 to 5 of 5
  1. #1
    ABW Ambassador Greg Rice's Avatar
    Join Date
    January 18th, 2005
    Location
    Ohio
    Posts
    4,889
    I fried my brain trying to make this work and all I found was about 200 ways it won't work. I setup some Rewrite rules in my .htaccess file to rewrite my product pages from prod_detail.php?ProdID=138711 to prod_detail138711.html and this works fine as long as my link points to the .html version.

    I want to stop the SEs from accessing the .php files and redirect them to the .html files permanently. Anyone know the proper way to write this? I would like Apache to redirect all pages like prod_detail.php?ProdID=138711 to prod_detail138711.html automatically when someone tries to access the .php page (mainly so the SEs don't penalize me for duplicate content). Any ideas?

    Once this is tackled, I can then work on my dynamic php recordset nav links, converting them to html.
    Greg Rice Affiliate Program Management
    www.gocmc.com info(AT)gocmc.com | 330-259-1223

    Join us! - MiNeeds.com | DiscountCandleShop/CheeseSupply | Feng Shui Plaza

  2. #2
    Full Member
    Join Date
    January 18th, 2005
    Posts
    270
    Try:

    RedirectMatch 301 /prod_detail.php?prodID=(.*)$ http://www.your_domain.com/prod_detail$1

    and

    RewriteRule /prod_detail(.*)$ /prod_detail.php?token=$1

    Strip out the ".html" in your php so you're left with just the 138711.

    Could be done differently, but this works for me.

    CodeJockey.

  3. #3
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    Xandman,

    Create a copy of prod_detail.php, prod_detail2.php and use that for the mod_rewrite of the .html version.

    Then, permanently redirect any reference of the old page, prod_detail.php, to the .html version. You can do that either in .htaccess or right in PHP. Either way you want to use a 301 permanent redirect.

  4. #4
    ABW Ambassador Greg Rice's Avatar
    Join Date
    January 18th, 2005
    Location
    Ohio
    Posts
    4,889
    Thanks much, I'll give this a try. Don't know why but I didn't get notice of your replies so I apologize for not responding sooner. Was just getting ready to address this again and thought I'd check for any help here. Thanks again.
    Greg Rice Affiliate Program Management
    www.gocmc.com info(AT)gocmc.com | 330-259-1223

    Join us! - MiNeeds.com | DiscountCandleShop/CheeseSupply | Feng Shui Plaza

  5. #5
    ABW Ambassador Greg Rice's Avatar
    Join Date
    January 18th, 2005
    Location
    Ohio
    Posts
    4,889
    This doesn't seem to be working for me. Here's what I have in my .htaccess file for the prod_detail page:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^prod_detail(.*)\.html$ /prod_detail\.php?ProdID=$1

    I have my links to the products like this:

    prod_detail138711.html

    and this works fine. What I wish to do is prevent the SEs from accessing the php files (prod_detail.php?ProdID=138711) since they are already spidered and indexed. So, when Google comes back to spider, I don't want them to be able to see the prod_detail.php?ProdID=138711 file but be permanently redirected to the html file. I'm concerned that if Google can still see the php page and the html version of that page I may be penalized for duplicate content.

    Is it possible with Apache to have a request for prod_detail.php?ProdID=138711 be automatically and permanently redirected to prod_detail138711.html? I don't have links to the php version but I can still access it and Google has the php version indexed. Hope this makes sense. Thanks for all your help.
    Greg Rice Affiliate Program Management
    www.gocmc.com info(AT)gocmc.com | 330-259-1223

    Join us! - MiNeeds.com | DiscountCandleShop/CheeseSupply | Feng Shui Plaza

  6. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Apache question
    By DHolland in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: October 1st, 2008, 07:43 PM
  2. Apache 301 Permanent Redirect Issue
    By popdawg in forum Domains & Hosting
    Replies: 3
    Last Post: September 21st, 2006, 09:50 PM
  3. shtml or apache handler?
    By Cheesehead in forum Programming / Datafeeds / Tools
    Replies: 0
    Last Post: May 25th, 2006, 11:27 AM
  4. Apache Rewrites For The New CJ Links?
    By Peteza in forum Commission Junction - CJ
    Replies: 7
    Last Post: June 3rd, 2005, 04:48 PM

Posting Permissions

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