regex - How redirect .htaccess to www. version? (not working) -


I have the following code in .htaccess . It does not work for any reason, can anyone see why? This is in the root of my website.

  option + reciprocal link rewriting engine redirection on the # limit once (redirects to server crash) rewrite option MaxRedirects = 10 # version of the website RevertCand% {HTTP_HOST}! ^ Www. [NC] REERTUR ^^ (. *) $ Http://www.MYDOMAIN.COM/$1 [R = 301]  

Obviously, mydomain.com Thanks in advance to anyone who can solve my problem with any of my domain names!

Update:

This does not work any problems but if I reach mydomain.com/link1/link2/ it does not work is.

There is .htaccess for '/ link2 /':

  # Settings option + FollowSymLinks revertinigine #homepage DirectoryIndex at index.php  
< P> and for '/ link1 /':

  # / linkgenerator / is never used, but temporal redirects for cleanliness redirect 302 / fbwiki / linkgenerator / / fbwiki / link- Generator / #Serve error pages ErrorDocument 400 /link1/error.php ErrorDocument 401 /link1/error.php ErrorDocument 403 /link1/error.php? Status = 403 error document 404 /link1/error.php?status=404 error document 500 /link1/error.php?status=500  

This is not working for sub directories because those sub-directors have their rewrite rules and by default these rules from the lower level .htaccess their parents Have not met.

You have 2 options to overcome this:

  1. Forcing the same www rules with your lower level .htaccess or
  2. Add this line to the top of your lower level .htaccess files:

      RewriteEngine RewriteOptions will rise # of the remaining rules     

    Update: Keep your www rule like this:

      rewrite% {HTTP_HOST}! ^ Www. [NC] REERTIRUL ^ ^ http: //www.% {HTTP_HOST}% {REQUEST_URI} [L, NE, R = 301]  

Comments