Forum Moderators: phranque

Message Too Old, No Replies

Help needed for .htaccess

         

btlr

3:24 pm on Mar 22, 2011 (gmt 0)

10+ Year Member



Hi to all,

I have a main domain and a sub domain setup.
Here is the structure
/live/
index.php
page_a.php

/sub/
index.php
page_b.php

1)How do I set this up?
When user enter the main domain, it does an internal rewrite to /live folder. I will need to enforce the 'www' to avoid duplicate content.

When user enter the subdomain, it internally rewrite to /sub folder

Here is my htaccess. It is not working as I keep seeing a 404 error. Thanks in advance.


[size=3]
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.mydomain.com$ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com
RewriteRule ^$ /%1 [L]

### Rewrite request to a directory ###
#RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
#RewriteCond %{REQUEST_URI} !^/sub/
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ /sub/$1
#RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
#RewriteRule ^(/)?$ sub/index.php [L]
[/size]

btlr

1:37 pm on Mar 24, 2011 (gmt 0)

10+ Year Member



No one is able to help me?