mdedens Posted January 18, 2007 Posted January 18, 2007 (edited) Hi, I setup a 301 redirect for a directory that contained numerous subdirectories, (all got indexed by Google accidentally.) Here is an example of the code: >redirect 301 /olddir http://www.****/index.php However if I go to a link like this: >http://www.****/olddir/album01/blahblah It ends up going here: >http://www.****/index.php/album01/blahblah I don't know the names of all the subdirectories, there are hundreds too. So I was wondering if there is a way to include all subdirectories in 1 line of code. Thanks for any suggestions. oye, sorry about the URLs, i forgot those are probably not allowed... trying to turn them off... ok got it. Edited January 18, 2007 by mdedens Quote
TCH-Andy Posted January 18, 2007 Posted January 18, 2007 Do you have any other code in your .htaccess that is messing things up ? Quote
mdedens Posted January 18, 2007 Author Posted January 18, 2007 (edited) Possibly... I have this line above it: (my old site had an index.shtml page, but the new one is .php) >redirect 301 /index.shtml http://www.****.com/index.php and this below it, for image protection and redirecting the non-www domain: >Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_Host} ^****.com [NC] RewriteRule ^(.*)$ http://www.****.com/$1 [L,R=301] RewriteCond %{HTTP_REFERER} !^http://****.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://****.com [NC] RewriteCond %{HTTP_REFERER} !^http://www.****.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://www.****.com [NC] RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC] Sorry I shoulda posted this in the first place. (not sure if that bottom part is the most efficient way to redirect and image protect, i keep seeing many different ways and don't know what's best) Edited January 18, 2007 by mdedens Quote
click Posted January 18, 2007 Posted January 18, 2007 Try: >redirectmatch 301 /olddir/.* http://www.****/index.php Quote
mdedens Posted January 19, 2007 Author Posted January 19, 2007 (edited) Thank you click, works perfectly now. Edited January 19, 2007 by mdedens Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.