Forum Moderators: phranque
I have a domain name example.com . I have a folder /html in my hosting account. I want to point the domain to that folder. Right now it points to the root. Could you please tell me what code I need to add to my .htaccess file? Also the browser should show the original URL and not the redirected URL while accessing.
Thanks,
Vincent
[edited by: jdMorgan at 2:20 pm (utc) on April 26, 2005]
[edit reason] Examplified. [/edit]
If this isn't an option for some reason, the other solution is a mod_rewrite-based on, with the Rewrite directives in a .htaccess file. Note that in order for this to work, the server must be configured with the mod_rewrite module loaded, and the 'FileInfo' option must be applied to the AllowOverride directive which applies to your *current* DocumentRoot. If all these apply, then something like the following in a .htaccess file:
RewriteEngine on
#
# If we don't exclude /html/ from the Rewrite'ing,
# we'll wind up in an infinite loop. Yick.
RewriteCond %{REQUEST_URI}!^/html/
#
# Rewrite
RewriteRule ^(.*) /html/$1 [L]
That information really helped us a lot.
Ours is a shared hosting platform and my hosting account is hosted on UNIX, apache web server. On this platform every individual hosting account has got hidden .htaccess file. Using FTP we can download and add codes to this file. Can you please give me a tutorial link on the net where I can find the full configuration of this .htaccess file? I searched on net but didn’t get any easy to understand link.
Thanks,
Vincent
The next thing you'll need to take note of is the value of the 'Override' for a particular directive. If you want to use a particular directive in a .htaccess file, the argument to 'Override' (in the case of AddAltByType, the Override is 'Indexes') MUST be used an an argument to the AllowOverride directive which applies to the directory in which you're placing the .htaccess file.
Get that? =)
For instance, let's say you want to place a .htaccess file in:
/var/www/domains/example.com/htdocs/images/
<Directory /var/www/domains>
AllowOverride Indexes
(other directives)
</Directory>
Of course, if you place an directive in a .htaccess file that's disallowed by httpd.conf, you'll get a 500 Internal Server Error when you try and access a page in the directory with the .htaccess file. Of course, you'll also get that error if you've misconfigured a directive in your .htaccess file.
Does this help?