Jump to content

using mod_rewrite and force www


cane_cc72

Recommended Posts

Posted

My domain is apparently setup to not use www in the url so I was trying to use force www in htaccess my problem is using both I keep getting error  ERR_TOO_MANY_REDIRECTS

my htaccess looks like for mod_write for friendly url's

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

with 1st attempt at adding force www of course i changed example.com to my boards url

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Always use www in the domain
# Replace 'example.com' with your domain name
 RewriteEngine on
 RewriteCond %{HTTP_HOST} ^([a-z.]+)?example\.com$ [NC]
 RewriteCond %{HTTP_HOST} !^www\. [NC]
 RewriteRule .? http://www.%1example.com%{REQUEST_URI} [R=301,L]
</IfModule>

 2nd attempt 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond "%{HTTP_HOST}" "!^www\."         [NC]
RewriteCond "%{HTTP_HOST}" "(.*)"
RewriteRule "(.*)"         "http://www.%1$1" [R=301,L]
</IfModule>

both produced the same error ERR_TOO_MANY_REDIRECTS  

Posted

What's up @cane_cc72,

  1. Revert your htaccess file back to default.
  2. Visit your hosting provider (wherever your domain is hosted).
  3. Edit your DNS Zone Editor to configure 'www' OR simply apple a 301 redirect from 'domain.com' to 'www.domain.com'
  4. :)
     

Cheers

Posted
12 minutes ago, cane_cc72 said:

Thank You.

No problem.

If I was any help, feel free to "like" my post :)
If I can be of any additional help in the future, save my email :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...