Status
Not open for further replies.

WoodenToys.ie

New Member
Hi folks,

I'm moving a component of a website from a subfolder into the root.

So www.mysite.com/subfolder/page1.html

becomes

www.mysite.com/page1.html

However, I want the old links to continue working (becuase Google has indexed them, among other reasons).

What should the rewrite rule look like?

I've tried the following:

RewriteRule ^subfolder/(.*)$ $1

This works on my localhost installation, but not on my web host installation. Other rewrite rules are working fine.

Any ideas?

Thanks in advance
 

paul

Ninja
check the order of your rewrites, as there could be inheritance issues.
 

companyhotseat

New Member
Hope This works for you

Hi,

Just to let you know the way I do a .htaccess file. Create a text doc and enter the code below. Save the text doc and upload it to your ftp as is. Then rename the file to .htaccess. Let me know if you have any joy!

Redirect 301 www.mysite.com/subfolder/page1.html http:/www.mysite.com/page1.html
 

WoodenToys.ie

New Member
Thanks Companyhotseat.

The trouble is, there are hundreds of indexed links of that form that I want to redirect - so I need a general rerwrite rule so that all requests for ../catalog/blahblah get rewritten as ../blahblah

The following rule is working for me on the test installation on my machine running wamp server, but it won't work on the soon to be live site.

RewriteRule ^subfolder/(.*)$ $1

@Paul - I've tried rearranging the order, but no joy. Why would it work on my Wamp server installation and not on my hosted site - and why are all the other rewrites ok?!?

I'm stumped!
 

WoodenToys.ie

New Member
I had a feeling it was something stupid - but I was wrong... it was something REALLY REALLY stupid.

At previous attempts to get this working, I'd placed a .htaccess file in the empty subfolder, from which I wanted to redirect stuff... so this was interfering with the whole process. This folly was not repeated on my local host version, so thus, no error.

Sorry for wasting the time of anyone who read this thread!
 
Status
Not open for further replies.
Top