Forum Moderators: phranque

Message Too Old, No Replies

How to point a domain to a sub folder?

domain pointing

         

weilies

2:15 am on Feb 26, 2008 (gmt 0)

10+ Year Member



I have created my addon domain

public_html/www.mydomain.com/

Which mean everytime "www.mydomain.com/index.php" will refer to
public_html/www.mydomain.com/index.php

Then my question is,
"how can i make www.mydomain.com/index.php"
refer to
public_html/www.mydomain.com/web/index.php
via .htaccess? (because i'm using shared host, and couldn't access httpd.conf)

furthermore, i have my


# Do not change this line.

RewriteEngine on

# Change yourdomain.com to be your main domain.

RewriteCond %{HTTP_HOST} ^(www.)?example.com.com$

# Change 'subfolder' to be the folder you will use for your main domain.

RewriteCond %{REQUEST_URI} !^/web/

# Don't change this line.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.

RewriteRule ^(.*)$ /web/$1

# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ web [L]

And everytime i type
"www.example.com" it will redirect to "www.example.com/web"
Everything work fine, but i just dont want the tail "/web" to be show to public, how can i do that?

Thanks

[edited by: jdMorgan at 5:06 am (utc) on Feb. 26, 2008]
[edit reason] Please use example.com. See TOS. [/edit]

jdMorgan

5:13 am on Feb 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's likely that some other code, in httpd.conf, in a higher- or lower-level .htaccess file, or in your PHP file(s) is invoking an external redirect. This is the only mechanism by which the client (e.g. browser) can be informed of a change in the URL -- External redirects involve and inform the client, while internal rewrites are not 'exposed' unless followed by an external redirect.

Since none of your rules contains a substitution address including a domain or includes the [R] flag, they are not responsible for this redirection.

[added]
It's possible your server would be happier if you changed that final rule to


RewriteRule ^(/)?$ /web/ [L]

as this redirect could be the result of mod_dir doing a "missing trailing slash" fix-up.
[/added]

Jim

[edited by: jdMorgan at 5:26 am (utc) on Feb. 26, 2008]