SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess rewrite rule not executing like expected

    Hey,

    I have this code in my .htaccess file:

    Code:
    RewriteEngine On
    rewriteCond %{HTTP_HOST} !^www\.abstractpromotion\.com [NC]
    rewriteRule ^(.*)$ http://www.abstractpromotion.com/$1 [R=301]
    # BEGIN WordPress
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    # END WordPress
    This is the same code that I have on some other sites of mine, just the URL is different. What I want is when the user enters abstractpromotion.com it redirects them to www.abstractpromotion.com. Now this works on my other sites, but when I type in abstractpromotion.com without the www, the server now says
    Moved Permanently
    The document has moved here.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
    Test it out: type abstractpromotion.com in your browser and then try with the www. Any ideas on how to fix this?
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  2. #2
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind, I fixed it - needed a L after the R=301
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches

  3. #3
    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)
    poss,

    I'm glad that you figured that one out on your own! Easy to spot but that means that you DO have some idea what you're doing!

    As for the 500, there must be an improperly formatted ErrorDocument statement in your .htaccess. Just remember,

    ErrorDocument [code] [absolute redirection]

    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
  •