SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What Kind of Redirect Would This Be?

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^test.co.uk$ [NC]
    RewriteRule ^(.*)$ http://test.co.uk/$1 [L,R=301]
    I noticed theres no www anywhere, so what kind of redirect would this be?

    And what is the proper way to redirect a wordpress site from http://www.site.co.uk/ to http://site.co.uk/?

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

    Why the RewriteBase directive?

    Is it possible/likely that you'd have test.co.uk co-located with any other domain (except www.test.co.uk, of course)?

    I'd not bother creating a new Apache variable with (.*) so I'd replace your rule with:
    Code:
    RewriteRule .? http://test.co.uk%{REQUEST_URI} [R=301,L]
    www or not? What's your preference? What have you used when you configured WP? Generally speaking, they're the same (except when using https) so don't sweat the petty stuff.

    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


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
  •