SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redirecting with .htaccess

    I'm at a bit of a loss for what exactly to do. What I'm trying to do is redirect all requests to http://www.cpadventures.com/forum to http://cpadventures.com/forum

    I've tried the following but that didn't work.
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^cpadventures.com/forum$ [NC]
    RewriteRule ^(.*)$ http://cpadventures.com/forum/$1 [L,R=301]
    I've read up on .htaccess but it's a little greek to me. I know that I should put the .htaccess file in the root of the forum folder. What I'm unsure about is the code to do that. Currently there is not a .htaccess file so it would be starting one from scratch. If anyone could help I would genuinely appreciate it!
    Apple Mac HQ - Apple/Mac News, Reviews, and More

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    kf,

    You've fallen into the trap of using crap regex including the dreaded EVERYTHING atom! Horrors! There may be no hope for you!

    Okay, seriously, a little time at the tutorial Article linked in my signature has helped MANY in this forum and it should help you to understand WHY (.*) is no good, why your RewriteCond regex will NEVER be matched and why (I hope) you should not be using RewriteBase. It WILL give you code to do what you're trying to do, however, so all should not be lost. If you have questions after reading, ask.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Server Systems Administration NZ
    SSANZ.NET | Server Security | Hosting Systems
    Experienced, Professional & Available 24/7


Bookmarks

Posting Permissions

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