Irish SEO,  Marketing & Webmaster Discussion

 

.htaccess rewrite rule

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, ...


Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help

Register Forum Rules FAQDonate Members List Calendar Search Today's Posts Mark Forums Read


Notices

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 22-07-2008, 02:33 PM
Frontpage User
 
Join Date: Jul 2008
Posts: 5
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
WoodenToys.ie will become famous soon enough
Default .htaccess rewrite rule

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 22-07-2008, 02:40 PM
paul's Avatar
Web Whore
Recent Blog: O?Zapft is!
 
Join Date: Dec 2006
Location: .de
Posts: 1,046
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
paul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud ofpaul has much to be proud of
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 22-07-2008, 07:46 PM
companyhotseat's Avatar
Coder
 
Join Date: Nov 2007
Posts: 30
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
companyhotseat will become famous soon enough
Cool 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
__________________
CompanyHotSeat.com - The Free Irish Business Directory http://www.companyhotseat.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 23-07-2008, 02:15 PM
Frontpage User
 
Join Date: Jul 2008
Posts: 5
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
WoodenToys.ie will become famous soon enough
Default

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 23-07-2008, 02:49 PM
Frontpage User
 
Join Date: Jul 2008
Posts: 5
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
WoodenToys.ie will become famous soon enough
Default

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
htaccess, rewrite, rule

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

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


All times are GMT +1. The time now is 08:00 AM.


Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Hosted in Ireland by Blacknight - Test your ISP |Irish Hosting Directory| Armchair.ie|Logo by Eden Web Design|Avatars by Afterglow |Latest Blog Entries | VPS HostingAd Management by RedTyger

Search Engine Friendly URLs by vBSEO 3.2.0