...

View Full Version : Force www on a subdirectory



CodingHelp
01-13-2011, 02:26 AM
Hi i have a site with subdirectories

The main one is mysite.com and i have the "force www" code on the main domain so it changes to http://www.mysite.com

I have a sub directory, mysite.com/page1 and i would like a htaccess code to "force www" on my sub directory and everything inside it.

For example:

mysite.com/page1
Would be changed to http://www.mysite.com/page1

And everything else in the "page1" subdirectory gets forced with "www"

Example: mysite.com/page1/forum.php
Would change to: http://www.mysite.com/page1/forum.php


Thanks in advance

abduraooft
01-13-2011, 06:50 AM
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/page1/$1 [R=301,L] ?

CodingHelp
01-13-2011, 12:22 PM
Where do i Insert my domain in that code?

Amd
I want the "force www" only to work when someone types: mysite.com/page1

If they type www.mysite.com/page1 Then it shouldnt redirect

CodingHelp
01-15-2011, 02:17 AM
help????

CodingHelp
05-16-2011, 06:51 PM
Anyone help??

Inigoesdr
05-17-2011, 04:03 AM
Did you try abduraooft's code? You don't have to enter your domain because he used %{HTTP_HOST}, which is the requested domain.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum