| 11:31 am on Nov 22, 2009 (gmt 0)|
i haven't tested it but this might work:
RedirectMatch permanent ^(([^/]+/)*)([^/]*)$ http://example.co.uk/$3
| 12:07 pm on Nov 22, 2009 (gmt 0)|
I added your code to the htaccess in my root. Its Not currently working. I am not too clued up on htaccess. I am wondering why it doesnt work. Could your suggested code be interfered with by other already existing code in my htaccess. Or could it be that the htaccess in the subfolder is overruling the htaccess in my root ?
| 1:17 pm on Nov 22, 2009 (gmt 0)|
yes it could be affected by all of the above and by what is in your apache config file and whether mod_alias is running on your server.
and assuming it's an apache server.
| 1:31 pm on Nov 22, 2009 (gmt 0)|
What is the best way to move forward with this type of thing?
| 3:01 pm on Nov 22, 2009 (gmt 0)|
Not too long ago I did the same thing that you want to do. This is what worked for me:
RewriteRule ^folder(/(.*))?$ /$2 [R=301,L]
Change folder in the above example to the name of your unwanted folder.
| 4:03 pm on Nov 22, 2009 (gmt 0)|
Thanks for posting icedowl. Where does this code go ? Does it go in .htaccess in the root or in the folder ?
Also do I add it into the htaccess with the code thats already in there or do I add it over the exisitng code. And does it work with permalinks enabled ?
| 4:37 pm on Nov 22, 2009 (gmt 0)|
I have mine as the very first thing in my htaccess file, which is in the root (public_html).
I'm not sure about it working with permalinks or your other questions. Maybe someone else knows or you could just try it and see what happens.
| 8:21 pm on Nov 22, 2009 (gmt 0)|
you wont believe it.
I added that line and got an internal error. I took the line out and the internal error persists. I cant work it out as I never changed anything else.
Ive had to disable the htaccess for the time being. Ive contacted my hosts to see what they make of it.
Very strange indeed.
| 11:44 pm on Nov 22, 2009 (gmt 0)|
you must clear your cache before testing any changes.
the order of things is important.
you should definitely be using a tool that will show you request and response headers.
are you doing any redirects in the apache config file?
are you getting a single 301 response or is there a chain of redirects?
are you doing any internal rewrites?
i would suggest you post an exemplified version of your .htaccess file in the Apache forum with a description of the response/redirect chain you get from the server.
| 12:34 pm on Nov 23, 2009 (gmt 0)|
Thanks Phranque. I will do that.