Results 1 to 5 of 5

Thread: .htaccess rewrite rule

  1. #1
    Coder
    Join Date
    Jul 2008
    Posts
    56
    Post Thanks / Like

    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

  2. #2
    ninja SEO paul's Avatar
    Join Date
    Dec 2006
    Location
    .de
    Posts
    1,503
    Post Thanks / Like

    Default

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

  3. #3
    Coder companyhotseat's Avatar
    Join Date
    Nov 2007
    Posts
    30
    Post Thanks / Like

    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/

  4. #4
    Coder
    Join Date
    Jul 2008
    Posts
    56
    Post Thanks / Like

    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!

  5. #5
    Coder
    Join Date
    Jul 2008
    Posts
    56
    Post Thanks / Like

    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!

Similar Threads

  1. Mod Rewrite
    By webman1 in forum Search Engine Optimisation
    Replies: 17
    Last Post: 30-07-2008, 09:50 PM
  2. .htaccess redirect
    By wheres me jumpa in forum Coding Help
    Replies: 5
    Last Post: 24-03-2008, 04:35 PM
  3. Installing ISAPI Rewrite
    By glengara in forum Server / Technical Administration Tips and Queries
    Replies: 4
    Last Post: 01-10-2007, 11:38 AM
  4. Welcome panel rewrite
    By wheres me jumpa in forum Forum Management
    Replies: 2
    Last Post: 09-09-2007, 02:01 PM
  5. Wordpress .htaccess file for no-www and mod-rewrite()
    By Cormac in forum Blogs & Blogging
    Replies: 9
    Last Post: 20-03-2007, 08:31 AM

Visitors found this page by searching for:

rewrite rules like twitter

rewriterule wamp

wamp RewriteRule

wampserver htaccess rewrite

htaccess rewrite rules

how rewrite rules wamp htaccess

wamp .htaccess RewriteRule doesnt work

rewriterule like twitter

twitter link # htaccess

wampserver rewriterules

rewrite rule like twitter

RewriteRule display text htaccess

rewriterule ^twitter

wamp rewriterule 301

wamp server instal RewriteRule

rewriterule ^(.*)doesnt work

wampserver rewriterule

wampserver htaccess redirect root

wamp rewriterule subfolder

rewriterule htaccess wampserver

rewriterule wampserver

htaccess rewriterule twitter

rewriting rule wamp

wamp server rewrite rules

.htaccess wamp RewriteRule

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •