Forum Moderators: phranque
Problem:
Basically, I have a site with the portal being at [example.org...] . Recently I swapped the intended index from index.html to index.php, so in order to direct old users to the currently updated page (index.php) I added this in my htaccess:
DirectoryIndex index.php index.html
Redirectpermanent /index.html [example.org...]
It is working, but;
I have other subdomains under the same directory of the root, example: [w.example.org...] or conversely [example.org...]
The index page of that subdomain is supposedly [example.org...] . If I understand it correctly, htaccess is globally affecting everything below. Therefore, every subdomains with index.html is being redirected to the root now, which I totally didn't intend.
Help... this method I mentioned is the only way I know. Been googling, no vail so far...
[edited by: jdMorgan at 9:35 pm (utc) on Jan. 3, 2005]
[edit reason] Removed specifics per TOS. [/edit]
Welcome to WebmasterWorld!
Instead of using mod_alias, use mod_rewrite [httpd.apache.org], which can test the requested hostname and leave the URLs for non-www subdomains alone.
Options +FollowSymLinks
RewriteEngine on
# Rewrite only www.example.org/index.html and example.org/index.html to example.org/index.php
RewriteCond %{HTTP_HOST} ^(www\.)example\.org
RewriteRule ^index\.html$ http://example.org/index.php [R=301,L]