This is a discussion on .htaccess rewrite rule within the Coding Help forums, part of the Webmaster Help category; 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, ...
| |||||||
| Register | Forum Rules | FAQ | Donate | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||||
| check the order of your rewrites, as there could be inheritance issues.
__________________ my sites : irish poker / irish jobs / seo faq / advertise jobs free / green card / skiing |
| |||||
| 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
__________________ CompanyHotSeat.com - The Free Irish Business Directory http://www.companyhotseat.com/ |
| ||||
| 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! |
| ||||
| 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! |
| Tags |
| htaccess, rewrite, rule |
| Thread Tools | |
| Display Modes | |
|
|
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Mod Rewrite | sullyman1 | Search Engine Optimisation | 17 | 30-07-2008 09:50 PM |
| .htaccess redirect | wheres me jumpa | Coding Help | 5 | 24-03-2008 04:35 PM |
| Installing ISAPI Rewrite | glengara | Server / Technical Administration Tips and Queries | 4 | 01-10-2007 11:38 AM |
| Welcome panel rewrite | wheres me jumpa | Forum Management | 2 | 09-09-2007 02:01 PM |
| Wordpress .htaccess file for no-www and mod-rewrite() | Cormac | Blogs & Blogging | 9 | 20-03-2007 08:31 AM |