Results 1 to 5 of 5
April 27th, 2004, 07:45 PM #1
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.
April 27th, 2004, 08:01 PM #2
- Join Date
- January 18th, 2005
RedirectMatch 301 /prod_detail.php?prodID=(.*)$ http://www.your_domain.com/prod_detail$1
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.
April 27th, 2004, 08:04 PM #3
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.
May 4th, 2004, 03:11 PM #4
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.
May 4th, 2004, 04:22 PM #5
This doesn't seem to be working for me. Here's what I have in my .htaccess file for the prod_detail page:
RewriteRule ^prod_detail(.*)\.html$ /prod_detail\.php?ProdID=$1
I have my links to the products like this:
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.
By DHolland in forum Programming / Datafeeds / ToolsReplies: 2Last Post: October 1st, 2008, 07:43 PM
By popdawg in forum Domains & HostingReplies: 3Last Post: September 21st, 2006, 09:50 PM
By Cheesehead in forum Programming / Datafeeds / ToolsReplies: 0Last Post: May 25th, 2006, 11:27 AM
By Peteza in forum Commission Junction - CJReplies: 7Last Post: June 3rd, 2005, 04:48 PM