Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7891547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:38:45+00:00 2026-06-03T06:38:45+00:00

Here is my .htaccess file: Options +FollowSymlinks RewriteEngine on Rewritecond %{http_host} ^mysite.com [nc] Rewriterule

  • 0

Here is my .htaccess file:

Options +FollowSymlinks
RewriteEngine on

Rewritecond %{http_host} ^mysite.com [nc]
Rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule . /404.php

The 1st rewritecond / rewriterule block is to redirect the user to www if they entered the address without www.

The 2nd rewritecond / rewriterule block is to redirect the user to a page that I created if they enter a non-existent address.

Each of these rules works on its own:

If my .htaccess file contains only the first block, then it successfully redirects non-www addresses to the www address.

And if a non-existent address is entered, the user is successfully redirected to my page 404.php.

However, if the .htaccess file contains both blocks, and a non-www address is entered, then instead of a successful redirection to the www address, the following happens:

(1) The following is displayed on the page:

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.

Apache/1.3.41 Server at mysite.com Port 80

(2) The following entry is generated in the error log:

[Fri May 4 01:54:19 2012] [error] [client 109.109.109.109] mod_rewrite:
maximum number of internal redirects reached. Assuming configuration error. Use ‘RewriteOptions MaxRedirects’ to increase the limit if neccessary.

I assume that what happens is that an infinite loop is somehow being generated.

I’m wondering if telling the .htaccess file to stop processing commands if the first condition has been met would solve the problem. So does anyone know how to do this?

(Side note. In general, I find the documentation out there on .htaccess to be absolutely horrendous. I wonder if anyone else feels similarly.)

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:38:46+00:00Added an answer on June 3, 2026 at 6:38 am

    The [L] flag.

    http://httpd.apache.org/docs/2.4/rewrite/flags.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my htaccess file Options +FollowSymLinks RewriteEngine on # For Accessing Page http://www.domain.com/news/news-details.php
Here's what my htaccess looks like: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.site.com$ [NC]
Here goes my .htaccess file's content. Options +FollowSymLinks RewriteEngine On RewriteRule ^online-products$ products.php?type=online RewriteRule
Here is my entire .htaccess: RewriteEngine On RewriteBase /~user/sitetest/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+?)/?$
Here is the code I have currently in my .htaccess file: Options +FollowSymLinks RewriteEngine
in my .htaccess file i do have these lines: Options +FollowSymLinks RewriteEngine on RewriteCond
I have written the following rules in .htaccess RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com RewriteCond %1 !^www$
I try to change over htaccess from http://www.mydomain.com/pictures/generated/product/1/280_280_75/nopic.jpg to http://www.mydomain.com/pictures/generated/product/1/280_280_75/nopic1.jpg Here is my rules
Trying to set 301 redirect in .htaccess file and here is what i am
here is my .htaccess file, it works because the first rewriterule correctly redirects .html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.