.htaccess redirect to www in subfolder

I know that following code is required for redirecting a non www link to www link:

`
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]
`
And I have included it too on the main site's .htaccess. But the problem is that I have a gallery in a subfolder.

If I access http://domain.com/gallery/ it does not get redirected to www version.

I tried including the above code into .htaccess in gallery folder but then it redirects the gallery to site's homepage.

Pls suggest a fix so that non www gallery redirects to gallery having www link.

Comments

  • No SOlution?
  • try adding this to the top of your rule (if you don't already have it):

    `Options +FollowSymLinks`

    I'm not super familiar with .htaccess myself but from a quick search on google I found the same htaccess rules you used, but with the code above at the top.
  • Found the fix.

    SHould use this code:

    `
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.domain\.com
    RewriteRule (.*) http://www.domain.com/gallery/$1 [L,R=301]
    `
  • acrylian Administrator, Developer
    Do your really expect that fast help over Christmas days??? Anyway, these kind of redirection I can set via the admin backend of my provider.
  • Nope..I don't expect fast help in holidays. I am just posting my queries...you can answer them whenever you get time.

    Its just that I am free on holidays and I am working on making my own gallery perfect with ZP in these days. :)
  • acrylian Administrator, Developer
    Sure, but your second post above was a little impatient..;-)
  • Sorry. :P
Sign In or Register to comment.