Web Hosting Talk







View Full Version : .htacesss permanent redirect questions. Thanks for any help :-)


Miko
07-16-2007, 08:42 PM
Hi,
I just wanted to pick your brain and get some advise on how to correctly redirect a dynamic url to a static page without sending away spiders.
The htaccess below is working, however i want to be sure that I'm not sending spiders away :gone:

I want to redirect the following page:

www.site.com/index.php?do=bananato a static url like:

www.site.com/banana.phpI've tested the following htaccess code and it's working correctly, however i would like to get your opinion to see if I'm using the best way to do it and especially if it is the correct way to keep spiders crawling the page.


# Enable mod_rewrite, start rewrite engine
Options +FollowSymLinks
RewriteEngine on
#
# Internally rewrite search engine friendly static URL to dynamic filepath and query
RewriteRule /?$.php /index.php?do=$1 [L]
#
# Externally redirect client requests for old dynamic URLs to equivalent new static URLs
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?do=([^&]+)\ HTTP/
RewriteRule ^index\.php$ http://www.site.com/%1.php? [R=301,L]


Thank you for any input on the above :-)

Take care,
Miko

lexington
07-17-2007, 04:43 AM
I can help with this since I love SEO :) There may be other ways to do this but here is the easiest. You can add each entry for every page name. Use this in your htaccess file and it should work:

RewriteRule ^banana.php$ index.php?do=banana [L]

Be sure to place the htaccess file in the same directory as the file

Miko
07-17-2007, 07:20 AM
I can help with this since I love SEO :) There may be other ways to do this but here is the easiest. You can add each entry for every page name. Use this in your htaccess file and it should work:

RewriteRule ^banana.php$ index.php?do=banana [L]

Be sure to place the htaccess file in the same directory as the file

thanks for that, but won't I need to also place the 301 in the htaccess for keeping traffic?